summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--invert-bitfields.pl44
-rw-r--r--rtcm.c9
3 files changed, 47 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index 14565d8a..a7eeb390 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -229,7 +229,7 @@ EXTRA_DIST = \
valgrind-suppressions \
driver_proto.c \
logextract \
- statetable.el
+ invert-bitfields.pl
# This is not distributed
libgps: libgps.c .libs/libgps.a
diff --git a/invert-bitfields.pl b/invert-bitfields.pl
new file mode 100644
index 00000000..64f77eb0
--- /dev/null
+++ b/invert-bitfields.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+###############################################################################
+## ##
+## File: invert-bitfields.pl ##
+## Author: Wolfgang S. Rupprecht <wolfgang@wsrcc.com> ##
+## Created: Mon Jul 25 01:58:12 PDT 2005 ##
+## Contents: invert the bitfields ##
+## ##
+## Copyright (c) 2005 Wolfgang S. Rupprecht. ##
+## All rights reserved. ##
+## ##
+## $Id: invert-bitfields.pl,v 1.1 2005/07/25 09:21:19 wolfgang Exp $
+###############################################################################
+
+$inside = 0;
+$linestack = "";
+
+while (<>) {
+ if (/^[ ]+uint[ ]+parity:6;/) {
+ $inside = 1;
+
+ # print ">>> starting inside\n";
+
+ $linestack = $_ . $linestack;
+ }
+ elsif (/^[ ]+uint[ ]+_pad:2;/) {
+ $inside = 0;
+ $linestack = $_ . $linestack;
+ print $linestack;
+ $linestack = "";
+ # print ">>> starting outside\n";
+ }
+ else {
+ if ($inside) {
+ $linestack = $_ . $linestack;
+ }
+ else {
+ print $_;
+ }
+ }
+}
+
+# end
+
diff --git a/rtcm.c b/rtcm.c
index 981b39ec..8f9ee99f 100644
--- a/rtcm.c
+++ b/rtcm.c
@@ -82,11 +82,7 @@ Starlink's website.
#pragma pack(1)
-#if (BYTE_ORDER != LITTLE_ENDIAN) && (BYTE_ORDER != BIG_ENDIAN)
-# error Not litle endian and not big endian.
-#endif
-
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef WORDS_BIG_ENDIAN /* little-endian, like x86 */
struct rtcm_msg_t {
struct rtcm_msghw1 { /* header word 1 */
@@ -290,9 +286,8 @@ struct rtcm_msg_t {
#endif /* LITTLE_ENDIAN */
-#if BYTE_ORDER == BIG_ENDIAN
+#if WORDS_BIG_ENDIAN
/* This struct was generated from the above using invert-bitfields.pl */
-
#ifndef S_SPLINT_S /* splint thinks it's a duplicate definition */
struct rtcm_msg_t {