Browse Source

* Add some macros to support compilation by old Borland C compiler

git-svn-id: trunk@19346 -
pierre 14 years ago
parent
commit
68a8746f8e
2 changed files with 34 additions and 13 deletions
  1. 16 10
      tests/test/cg/obj/ctest.c
  2. 18 3
      tests/test/cg/obj/tcext6.c

+ 16 - 10
tests/test/cg/obj/ctest.c

@@ -9,13 +9,19 @@
    to use them.
    to use them.
 */
 */
 
 
+#if defined(__BORLANDC__)
+#define long_long __int64
+#else
+#define long_long long long
+#endif
+
 unsigned char global_u8bit;
 unsigned char global_u8bit;
 unsigned short global_u16bit;
 unsigned short global_u16bit;
 unsigned int global_u32bit;
 unsigned int global_u32bit;
 short global_s16bit;
 short global_s16bit;
 int global_s32bit;
 int global_s32bit;
-long long global_s64bit;
-unsigned long long global_u64bit;
+long_long global_s64bit;
+unsigned long_long global_u64bit;
 float global_float;
 float global_float;
 double global_double;
 double global_double;
 long double global_long_double;
 long double global_long_double;
@@ -59,7 +65,7 @@ struct _5BYTE_
 struct _7BYTE_
 struct _7BYTE_
 {
 {
 	unsigned char u8;
 	unsigned char u8;
-	long long s64;
+	long_long s64;
 	unsigned short u16;
 	unsigned short u16;
 };
 };
 
 
@@ -96,12 +102,12 @@ void test_param_s32(int v)
 }
 }
 
 
 
 
-void test_param_s64(long long v)
+void test_param_s64(long_long v)
 {
 {
   global_s64bit = v;
   global_s64bit = v;
 }
 }
 
 
-void test_param_u64(unsigned long long v)
+void test_param_u64(unsigned long_long v)
 {
 {
   global_u64bit = v;
   global_u64bit = v;
 }
 }
@@ -151,12 +157,12 @@ void test_array_param_s32(int v[2])
 }
 }
 
 
 
 
-void test_array_param_s64(long long v[2])
+void test_array_param_s64(long_long v[2])
 {
 {
   global_s64bit = v[1];
   global_s64bit = v[1];
 }
 }
 
 
-void test_array_param_u64(unsigned long long v[2])
+void test_array_param_u64(unsigned long_long v[2])
 {
 {
   global_u64bit = v[1];
   global_u64bit = v[1];
 }
 }
@@ -196,7 +202,7 @@ void test_param_mixed_u32(unsigned char z, unsigned int x, unsigned char y)
 	global_u8bit = y;
 	global_u8bit = y;
 }
 }
 
 
-void test_param_mixed_s64(unsigned char z, long long x, unsigned char y)
+void test_param_mixed_s64(unsigned char z, long_long x, unsigned char y)
 {
 {
 	global_s64bit = x;
 	global_s64bit = x;
 	global_u8bit = y;
 	global_u8bit = y;
@@ -305,7 +311,7 @@ unsigned int test_function_u32()
 	return RESULT_U32BIT;
 	return RESULT_U32BIT;
 }
 }
 
 
-unsigned long long test_function_u64()
+unsigned long_long test_function_u64()
 {
 {
 	return RESULT_U64BIT;
 	return RESULT_U64BIT;
 }
 }
@@ -320,7 +326,7 @@ unsigned int test_function_s32()
 	return RESULT_S32BIT;
 	return RESULT_S32BIT;
 }
 }
 
 
-unsigned long long test_function_s64()
+unsigned long_long test_function_s64()
 {
 {
 	return RESULT_S64BIT;
 	return RESULT_S64BIT;
 }
 }

+ 18 - 3
tests/test/cg/obj/tcext6.c

@@ -1,4 +1,19 @@
+#if defined(__BORLANDC__)
+/* ## include <stdint.h> */
+#define long_long __int64
+#define int8_t __int8
+#define uint8_t  unsigned __int8
+#define int16_t __int16
+#define uint16_t  unsigned __int16
+#define int32_t __int32
+#define uint32_t  unsigned __int32
+#define int64_t __int64
+#define uint64_t  unsigned __int64
+
+#else
 #include <stdint.h>
 #include <stdint.h>
+#define long_long long long
+#endif
 
 
 struct struct1 {
 struct struct1 {
   float v;
   float v;
@@ -131,9 +146,9 @@ these four paragraphs for those parts of this code that are retained.
 
 
 */
 */
 
 
-#define LIT64( a ) a##LL
+#define LIT64(a) a##LL
 
 
-#define double2float64( a ) (*(float64*)&(a))
+#define double2float64(a) (*(float64*)&(a))
 
 
 typedef char flag;
 typedef char flag;
 
 
@@ -143,7 +158,7 @@ typedef int64_t sbits64;
 
 
 bits64 extractFloat64Frac( float64 a )
 bits64 extractFloat64Frac( float64 a )
 {
 {
-    return a & LIT64( 0x000FFFFFFFFFFFFF );
+    return a & LIT64(0x000FFFFFFFFFFFFF) ;
 }
 }
 
 
 int16_t extractFloat64Exp( float64 a )
 int16_t extractFloat64Exp( float64 a )