Package: inventor / 2.1.5-10-21

endianness.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
Description: Use <endian.h> to determine machine word order
 The patch also generalizes the conditions for applying
 some 64-bit hacks.
Author: Steve M. Robbins <smr@debian.org>
Bug-Debian: http://bugs.debian.org/107470

--- inventor-2.1.5-10.orig/lib/database/include/machine.h
+++ inventor-2.1.5-10/lib/database/include/machine.h
@@ -176,6 +176,28 @@ extern int errno;		/* missing from errno
 #endif
 
 
+/* Added for Debian by Steve M. Robbins */
+#if !defined(MACHINE_WORD_FORMAT)
+#   include <endian.h>
+
+#   if __BYTE_ORDER == __BIG_ENDIAN
+#       define MACHINE_WORD_FORMAT	DGL_BIG_ENDIAN
+#   elif __BYTE_ORDER == __LITTLE_ENDIAN
+#       define MACHINE_WORD_FORMAT      DGL_LITTLE_ENDIAN
+#   else
+#       error Inventor needs to be set up for your CPU type.
+#   endif
+
+#   if __FLOAT_WORD_ORDER == __BIG_ENDIAN
+#       define MACHINE_FLOAT_FORMAT	DGL_BIG_IEEE
+#   else
+#       define MACHINE_FLOAT_FORMAT     DGL_NON_IEEE
+#   endif
+
+#endif
+
+
+
 
 /*
  * 32/64-bit architecture dependent statements
@@ -321,12 +343,10 @@ extern float dgl_ntoh_double();
  */
 
 #if MACHINE_FLOAT_FORMAT == DGL_NON_IEEE
-#if __i386__ || __ia64__
 void mem_hton_float(float *t, float *f);
 void mem_ntoh_float(float *t, float *f);
 void mem_hton_double(double *t, double *f);
 void mem_ntoh_double(double *t, double *f);
-#endif /* __i386__ || __ia64__ */
 #define DGL_HTON_FLOAT(t,f) mem_hton_float(&t,&f)
 #define DGL_NTOH_FLOAT(t,f) mem_ntoh_float(&t,&f)
 #define DGL_HTON_DOUBLE(t,f) mem_hton_double(&t,&f)
@@ -350,4 +370,11 @@ void mem_ntoh_double(double *t, double *
 #define SHORT(p) (*(short *)(p))
 #endif
 
+/* Added for Debian by Steve M. Robbins */
+#if (_MIPS_SZPTR == 64 || __ia64 || __x86_64 || __alpha__ || __powerpc64__ || __s390x__ || __aarch64__)
+#  define USE_64BIT_HACKS 1
+#else
+#  define USE_64BIT_HACKS 0
+#endif
+
 #endif /* __MACHINE_H__ */
--- inventor-2.1.5-10.orig/lib/interaction/src/draggers/SoDragger.c++
+++ inventor-2.1.5-10/lib/interaction/src/draggers/SoDragger.c++
@@ -52,6 +52,7 @@
  _______________________________________________________________________
  */
 
+#include <machine.h>
 #include <stdio.h>
 
 #include <Inventor/SbLinear.h>
@@ -686,7 +687,7 @@ SoDragger::isTempPathToThisOk()
 		int indexInPath = tempPathToThis->getIndex(numFmHead+1);
 
 		int numKidsNow    = children->getLength();
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (USE_64BIT_HACKS)
 		int numKidsBefore = (int) ((long) (*tempPathNumKidsHack)[numFmHead]);
 #else
 		int numKidsBefore = (int) (*tempPathNumKidsHack)[numFmHead];
--- inventor-2.1.5-10.orig/lib/nodekits/src/upgraders/SoV1NkCatalog.c++
+++ inventor-2.1.5-10/lib/nodekits/src/upgraders/SoV1NkCatalog.c++
@@ -51,7 +51,7 @@
  _______________________________________________________________________
  */
 
-
+#include <machine.h>
 #include <Inventor/misc/upgraders/SoV1NodekitCatalog.h>
 #include <Inventor/SoDB.h>
 #include <Inventor/misc/upgraders/SoV1BaseKit.h>
@@ -330,7 +330,7 @@ SoV1NodekitCatalog::getPartNumber( const
     void *castPNum;
 
     if ( partNameDict.find( (unsigned long) theName.getString(), castPNum ) )
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (USE_64BIT_HACKS)
 	return ( (int) ((long) castPNum) );  // System long
 #else
 	return ( (int) castPNum );
--- inventor-2.1.5-10.orig/lib/nodekits/src/nodekits/SoNkCatalog.c++
+++ inventor-2.1.5-10/lib/nodekits/src/nodekits/SoNkCatalog.c++
@@ -51,7 +51,7 @@
  _______________________________________________________________________
  */
 
-
+#include <machine.h>
 #include <Inventor/errors/SoDebugError.h>
 #include <Inventor/nodekits/SoNodekitCatalog.h>
 #include <Inventor/nodekits/SoNodeKitListPart.h>
@@ -336,7 +336,7 @@ SoNodekitCatalog::getPartNumber( const S
     void *castPNum;
 
     if ( partNameDict.find( (unsigned long) theName.getString(), castPNum ) )
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (USE_64BIT_HACKS)
 	return ( (int) ((long) castPNum) );  // System long
 #else
 	return ( (int) castPNum );
--- inventor-2.1.5-10.orig/lib/database/src/sb/SbTime.c++
+++ inventor-2.1.5-10/lib/database/src/sb/SbTime.c++
@@ -51,6 +51,7 @@
  _______________________________________________________________________
  */
 
+#include <machine.h>
 #include <Inventor/SbTime.h>
 #include <time.h>
 
@@ -264,7 +265,7 @@ SbTime::formatDate(const char *fmt) cons
 {
     char buf[200];
 
-#if (_MIPS_SZLONG == 64 || __ia64 || __APPLE__)
+#if (USE_64BIT_HACKS || __APPLE__)
     int  seconds;
     seconds = (int) t.tv_sec;
     strftime(buf, sizeof(buf), fmt, localtime((const time_t *) &seconds));
--- inventor-2.1.5-10.orig/lib/database/src/so/SoOutput.c++
+++ inventor-2.1.5-10/lib/database/src/so/SoOutput.c++
@@ -1462,7 +1462,7 @@ SoOutput::findReference(const SoBase *ba
 
     // Generates a CC warning. Ho hum.
     if (refDict->find((unsigned long) base, ref))
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (USE_64BIT_HACKS)
         referenceId = (int) ((unsigned long) ref);
 #else
 	referenceId = (int)ref;
--- inventor-2.1.5-10.orig/lib/database/src/so/SoType.c++
+++ inventor-2.1.5-10/lib/database/src/so/SoType.c++
@@ -51,6 +51,7 @@
  _______________________________________________________________________
  */
 
+#include <machine.h>
 #include <Inventor/SoType.h>
 #include <Inventor/SoLists.h>
 #include <Inventor/errors/SoDebugError.h>
@@ -331,7 +332,7 @@ SoType::fromName(SbName name)
     if (b == NULL)
 	return SoType::badType();
 
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (USE_64BIT_HACKS)
     SoType result = typeData[(int) ((unsigned long) b)].type;
 #else
     SoType result = typeData[(int)b].type;
--- inventor-2.1.5-10.orig/libSoXt/src/SoXtRsrc.c++
+++ inventor-2.1.5-10/libSoXt/src/SoXtRsrc.c++
@@ -51,6 +51,7 @@
  _______________________________________________________________________
  */
 
+#include <machine.h>
 #include <Inventor/SbPList.h>
 #include <Inventor/Xt/SoXtComponent.h>
 #include <Inventor/Xt/SoXt.h>
@@ -145,7 +146,7 @@ SoXtResource::SoXtResource(Widget widget
     classList = new XrmQuark[listSize];
     for (q = 0, s = len - 1;
     	 s >= 0; q++, s--) {
-#if (_MIPS_SZPTR == 64 || __ia64)
+#if (USE_64BIT_HACKS)
 	 nameList[q]  = (XrmQuark) ((long) nameplist[s]);
 	 classList[q] = (XrmQuark) ((long) classplist[s]);
 #else