rev 280 - in trunk: include/prothon src

SVN User <[email protected]>
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: bcollins
Date: 2004-04-04 16:00:07 -0400 (Sun, 04 Apr 2004)
New Revision: 280

Modified:
   trunk/include/prothon/prothon.h
   trunk/src/builtins-int.c
   trunk/src/builtins-list.c
   trunk/src/interp.c
Log:
Get rid of our internal LONG_LONG_{FMT,CAST} and use APR's definition's.


Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h	2004-04-04 19:47:46 UTC (rev 279)
+++ trunk/include/prothon/prothon.h	2004-04-04 20:00:07 UTC (rev 280)
@@ -73,16 +73,8 @@
 
 #ifdef WIN32
 #define PR_DECLARE_EXPORT		__declspec(dllexport)
-#define PR_PLACE_IN_SECTION(type,name,sect) \
-	__declspec(allocate(sect)) type name
-#define LONG_LONG_FMT			"%I64d"
-#define LONG_LONG_CAST			i64_t
 #else
 #define PR_DECLARE_EXPORT
-#define PR_PLACE_IN_SECTION(type,name,sect) \
-	type name __attribute__((section(sect), unused))
-#define LONG_LONG_FMT			"%lld"
-#define LONG_LONG_CAST			long long
 #endif
 
 //**************************** DEBUG DEFINITIONS *********************************
@@ -90,8 +82,8 @@
 //#define DEBUG_THREADS
 //#define DEBUG_MEM_MGR
 //#define TRACE_PARSER
-#define TRACE_INTERPRETER
-#define DUMP_MODULE_CODE
+//#define TRACE_INTERPRETER
+//#define DUMP_MODULE_CODE
 //#define DUMP_OBJECTS_AT_END
 
 //************************* BASIC TYPE DEFINITIONS ********************************

Modified: trunk/src/builtins-int.c
===================================================================
--- trunk/src/builtins-int.c	2004-04-04 19:47:46 UTC (rev 279)
+++ trunk/src/builtins-int.c	2004-04-04 20:00:07 UTC (rev 280)
@@ -291,7 +291,7 @@
 
 DEF(Int, __str__, NULL){
 	char str[24];
-	apr_snprintf(str, sizeof(str), LONG_LONG_FMT, (LONG_LONG_CAST)Int_value(self));
+	apr_snprintf(str, sizeof(str), "%"APR_INT64_T_FMT, (apr_int64_t)Int_value(self));
 	return new_string_obj(str);
 }
 

Modified: trunk/src/builtins-list.c
===================================================================
--- trunk/src/builtins-list.c	2004-04-04 19:47:46 UTC (rev 279)
+++ trunk/src/builtins-list.c	2004-04-04 20:00:07 UTC (rev 280)
@@ -136,8 +136,8 @@
 		index1 = (int)(slice_item1->data.i64);
 		if (index1 < 0) index1 += self_len;						
 		if (index1 < 0 || index1 >= self_len) {			
-			raise_exception(ist, OBJ(INDEX_EXC), "Index ("LONG_LONG_FMT") out of range",
-					(LONG_LONG_CAST)index1);
+			raise_exception(ist, OBJ(INDEX_EXC), "Index (%"APR_INT64_T_FMT") out of range",
+					(apr_int64_t)index1);
 			write_unlock(ist, self);  read_lock(ist, self); 
 			return NULL;									
 		}
@@ -183,8 +183,8 @@
 		index2 = (int)(slice_item2->data.i64);
 		if (index2 < 0) index2 += self_len;						
 		if (index2 < 0 || index2 > self_len) {			
-			raise_exception(ist, OBJ(INDEX_EXC), "Second index ("LONG_LONG_FMT") out of range",
-					(LONG_LONG_CAST)index2);
+			raise_exception(ist, OBJ(INDEX_EXC), "Second index (%"APR_INT64_T_FMT") out of range",
+					(apr_int64_t)index2);
 			write_unlock(ist, self);  read_lock(ist, self); 
 			return NULL;									
 		}
@@ -250,8 +250,8 @@
 		index1 = (int)(slice_item1->data.i64);
 		if (index1 < 0) index1 += self_len;						
 		if (index1 < 0 || index1 >= self_len) {			
-			raise_exception(ist, OBJ(INDEX_EXC), "Index ("LONG_LONG_FMT") out of range",
-					(LONG_LONG_CAST)index1);
+			raise_exception(ist, OBJ(INDEX_EXC), "Index (%"APR_INT64_T_FMT") out of range",
+					(apr_int64_t)index1);
 			write_unlock(ist, self);   read_lock(ist, self); 
 			return NULL;									
 		}
@@ -294,8 +294,8 @@
 		index2 = (int)(slice_item2->data.i64);
 		if (index2 < 0) index2 += self_len;						
 		if (index2 < 0 || index2 > self_len) {			
-			raise_exception(ist, OBJ(INDEX_EXC), "Second index ("LONG_LONG_FMT") out of range",
-					(LONG_LONG_CAST)index2);
+			raise_exception(ist, OBJ(INDEX_EXC), "Second index (%"APR_INT64_T_FMT") out of range",
+					(apr_int64_t)index2);
 			write_unlock(ist, self);   read_lock(ist, self); 
 			return NULL;									
 		}

Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c	2004-04-04 19:47:46 UTC (rev 279)
+++ trunk/src/interp.c	2004-04-04 20:00:07 UTC (rev 280)
@@ -1252,10 +1252,10 @@
 
 	if ((fstk_obj = get_attr(ist, orig_excobj, sym(ist, "frame_stack")))) {
 		for (i = (int) list_len(ist, fstk_obj) - 3; i >= 0; i -= 3) {
-			printf( "--- File: %s, line: "LONG_LONG_FMT", char: "LONG_LONG_FMT"\n",
+			printf( "--- File: %s, line: %"APR_INT64_T_FMT", char: %"APR_INT64_T_FMT"\n",
 				strch(list_item(ist, fstk_obj, i  )), 
-				*((LONG_LONG_CAST *)obj_data_p(list_item(ist, fstk_obj, i+1))), 
-				*((LONG_LONG_CAST *)obj_data_p(list_item(ist, fstk_obj, i+2))) );
+				*((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))) );
 		}
 	}
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.