add NULL definition and align types to their correct bitwidth
authorkoda
Tue, 01 May 2012 11:25:44 +0100
changeset 6971 b7b38e051b5f
parent 6970 59f33a6a4814
child 6972 1c267028a071
add NULL definition and align types to their correct bitwidth
hedgewars/pas2c.h
--- a/hedgewars/pas2c.h	Tue May 01 11:39:11 2012 +0200
+++ b/hedgewars/pas2c.h	Tue May 01 11:25:44 2012 +0100
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <stdint.h>
 #include <stdbool.h>
 
 typedef union string255_
@@ -25,14 +26,16 @@
         char s[16];
     } string15;
 
-typedef int SmallInt;
-typedef int Word;
-typedef int LongInt;
-typedef int LongWord;
-typedef int Byte;
-typedef int Integer;
-typedef long long int QWord;
+typedef uint8_t Byte;
+typedef int8_t ShortInt;
+typedef uint16_t Word;
+typedef int16_t SmallInt;
+typedef uint32_t LongWord;
+typedef int32_t LongInt;
+typedef uint64_t QWord;
+typedef int64_t Int64;
 
+typedef LongInt Integer;
 typedef float extended;
 typedef float real;
 
@@ -44,6 +47,17 @@
 typedef LongInt * PLongInt;
 typedef Integer * PInteger;
 
+#ifdef __GNUG__
+#define NULL __null
+#else   /* G++ */
+/* shield NULL definition for non-gnu parsers */
+#ifndef __cplusplus
+#define NULL ((void *)0)
+#else
+#define NULL 0
+#endif  /* __cplusplus */
+#endif  /* G++ */
+
 #define new(a) __new((void **)&a, sizeof(*(a)))
 void __new(void ** p, int size);