rev 286 - in trunk: include/prothon src

SVN User <[email protected]>
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: bcollins
Date: 2004-04-05 10:52:37 -0400 (Mon, 05 Apr 2004)
New Revision: 286

Modified:
   trunk/include/prothon/prothon.h
   trunk/include/prothon/prothon_dll.h
   trunk/src/builtins-int.c
   trunk/src/builtins-list.c
   trunk/src/interp.c
Log:
Switch our internal types to use apr types.


Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h	2004-04-05 14:49:46 UTC (rev 285)
+++ trunk/include/prothon/prothon.h	2004-04-05 14:52:37 UTC (rev 286)
@@ -60,6 +60,10 @@
 #include <apr_thread_proc.h>
 #include <apr_portable.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define PROTHON_VERSION_NUMBER	"0.0"
 #define PROTHON_VERSION_BUILD   "$Rev$"  
 #define PROTHON_VERSION_DATE	__DATE__
@@ -88,26 +92,18 @@
 
 //************************* BASIC TYPE DEFINITIONS ********************************
 
+typedef signed char		i8_t;
+typedef apr_int16_t		i16_t;
+typedef apr_int32_t		i32_t;
+typedef apr_int64_t		i64_t;
+typedef apr_byte_t		u8_t;
+typedef apr_uint16_t		u16_t;
+typedef apr_uint32_t		u32_t;
+typedef apr_uint64_t		u64_t;
+
 #ifdef WIN32
-typedef __int8			i8_t;
-typedef __int16			i16_t;
-typedef __int32			i32_t;
-typedef __int64			i64_t;
-typedef unsigned __int8		u8_t;
-typedef unsigned __int16	u16_t;
-typedef unsigned __int32	u32_t;
-typedef unsigned __int64	u64_t;
 #define MAX_INT_VAL		0x7fffffffffffffff
 #else
-#include <sys/types.h>
-typedef int8_t		i8_t;
-typedef int16_t		i16_t;
-typedef int32_t		i32_t;
-typedef int64_t		i64_t;
-typedef u_int8_t	u8_t;
-typedef u_int16_t	u16_t;
-typedef u_int32_t	u32_t;
-typedef u_int64_t	u64_t;
 #define MAX_INT_VAL		0x7fffffffffffffffLL
 #endif
 
@@ -895,4 +891,8 @@
 void del_lock  (obj_p obj);		
 void del_unlock(obj_p obj);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif // PROTHON_H

Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h	2004-04-05 14:49:46 UTC (rev 285)
+++ trunk/include/prothon/prothon_dll.h	2004-04-05 14:52:37 UTC (rev 286)
@@ -58,6 +58,10 @@
 
 #include <prothon/prothon.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
 	isp			(*get_ist)();
 	obj_p		(*get_attr)(isp ist, obj_p obj, obj_p key);
@@ -232,4 +236,9 @@
 #define dict_keys_values	(*services->dict_keys_values)
 
 #endif // OBJECT_H
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif // PROTHON_DLL_H

Modified: trunk/src/builtins-int.c
===================================================================
--- trunk/src/builtins-int.c	2004-04-05 14:49:46 UTC (rev 285)
+++ trunk/src/builtins-int.c	2004-04-05 14:52:37 UTC (rev 286)
@@ -291,7 +291,7 @@
 
 DEF(Int, __str__, NULL){
 	char str[24];
-	apr_snprintf(str, sizeof(str), "%"APR_INT64_T_FMT, (apr_int64_t)Int_value(self));
+	apr_snprintf(str, sizeof(str), "%"APR_INT64_T_FMT, (i64_t)Int_value(self));
 	return new_string_obj(str);
 }
 

Modified: trunk/src/builtins-list.c
===================================================================
--- trunk/src/builtins-list.c	2004-04-05 14:49:46 UTC (rev 285)
+++ trunk/src/builtins-list.c	2004-04-05 14:52:37 UTC (rev 286)
@@ -137,7 +137,7 @@
 		if (index1 < 0) index1 += self_len;						
 		if (index1 < 0 || index1 >= self_len) {			
 			raise_exception(ist, OBJ(INDEX_EXC), "Index (%"APR_INT64_T_FMT") out of range",
-					(apr_int64_t)index1);
+					(i64_t)index1);
 			write_unlock(ist, self);  read_lock(ist, self); 
 			return NULL;									
 		}
@@ -184,7 +184,7 @@
 		if (index2 < 0) index2 += self_len;						
 		if (index2 < 0 || index2 > self_len) {			
 			raise_exception(ist, OBJ(INDEX_EXC), "Second index (%"APR_INT64_T_FMT") out of range",
-					(apr_int64_t)index2);
+					(i64_t)index2);
 			write_unlock(ist, self);  read_lock(ist, self); 
 			return NULL;									
 		}
@@ -251,7 +251,7 @@
 		if (index1 < 0) index1 += self_len;						
 		if (index1 < 0 || index1 >= self_len) {			
 			raise_exception(ist, OBJ(INDEX_EXC), "Index (%"APR_INT64_T_FMT") out of range",
-					(apr_int64_t)index1);
+					(i64_t)index1);
 			write_unlock(ist, self);   read_lock(ist, self); 
 			return NULL;									
 		}
@@ -295,7 +295,7 @@
 		if (index2 < 0) index2 += self_len;						
 		if (index2 < 0 || index2 > self_len) {			
 			raise_exception(ist, OBJ(INDEX_EXC), "Second index (%"APR_INT64_T_FMT") out of range",
-					(apr_int64_t)index2);
+					(i64_t)index2);
 			write_unlock(ist, self);   read_lock(ist, self); 
 			return NULL;									
 		}

Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c	2004-04-05 14:49:46 UTC (rev 285)
+++ trunk/src/interp.c	2004-04-05 14:52:37 UTC (rev 286)
@@ -1254,8 +1254,8 @@
 		for (i = (int) list_len(ist, fstk_obj) - 3; i >= 0; i -= 3) {
 			printf( "--- File: %s, line: %"APR_INT64_T_FMT", char: %"APR_INT64_T_FMT"\n",
 				strch(list_item(ist, fstk_obj, i  )), 
-				*((apr_int64_t *)obj_data_p(list_item(ist, fstk_obj, i+1))), 
-				*((apr_int64_t *)obj_data_p(list_item(ist, fstk_obj, i+2))) );
+				*((i64_t *)obj_data_p(list_item(ist, fstk_obj, i+1))), 
+				*((i64_t *)obj_data_p(list_item(ist, fstk_obj, i+2))) );
 		}
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.