From ba593c2647b01ac8c4e897540fb0c0f09cbf1f73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Tue, 23 Nov 2010 14:22:13 +0100
Subject: [PATCH] Added support for hexadecimal bignum literals in the
 preprocessor.

---
 .gitattributes     |  1 -
 src/preprocessor.h | 17 +++++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/.gitattributes b/.gitattributes
index 10f716d12b..c11ae72dbb 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -777,7 +777,6 @@ testfont binary
 /src/post_modules/_Image_SVG/configure.in foreign_ident
 /src/post_modules/_Image_SVG/svg.c foreign_ident
 /src/post_modules/configure.in foreign_ident
-/src/preprocessor.h foreign_ident
 /src/program_areas.h foreign_ident
 /src/program_id.h foreign_ident
 /src/queue.c foreign_ident
diff --git a/src/preprocessor.h b/src/preprocessor.h
index e9da7d8fc3..614bde8906 100644
--- a/src/preprocessor.h
+++ b/src/preprocessor.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: preprocessor.h,v 1.97 2010/09/19 15:03:27 marcus Exp $
+|| $Id$
 */
 
 /*
@@ -460,11 +460,14 @@ static ptrdiff_t calcC(struct cpp *this, WCHAR *data, ptrdiff_t len,
   case '0':
     if(data[pos+1]=='x' || data[pos+1]=='X')
     {
-      PCHARP p;
-      long val = STRTOL_PCHARP(MKPCHARP(data+pos+2, SHIFT), &p, 16);
-      if(OUTP())
-	push_int(val);
-      pos = ((WCHAR *)p.ptr) - data;
+      void *p = data + pos + 2;
+      push_int(0);
+
+      safe_wide_string_to_svalue_inumber(Pike_sp-1, p, &p, 16, 0, SHIFT);
+
+      if(!OUTP()) pop_stack();
+
+      pos = ((WCHAR *)p) - data;
       break;
     }
     
@@ -475,6 +478,8 @@ static ptrdiff_t calcC(struct cpp *this, WCHAR *data, ptrdiff_t len,
     PCHARP p;
     double f;
     long l;
+
+    /* FIXME: Support bignums. */
     
     p = MKPCHARP(data+pos, SHIFT);
     f = STRTOD_PCHARP(p, &p1);
-- 
GitLab