From 8330d63eb304e2549b93c536fcaad071f02664e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Tue, 24 Aug 1999 22:05:55 -0700
Subject: [PATCH] fixed #if constant(.foo)

Rev: src/cpp.c:1.53
---
 src/cpp.c | 43 +++++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/src/cpp.c b/src/cpp.c
index 33b32a2d15..670369a269 100644
--- a/src/cpp.c
+++ b/src/cpp.c
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: cpp.c,v 1.52 1999/08/17 19:00:27 grubba Exp $
+ * $Id: cpp.c,v 1.53 1999/08/25 05:05:55 hubbe Exp $
  */
 #include "global.h"
 #include "language.h"
@@ -953,26 +953,37 @@ static void check_constant(struct cpp *this,
     if(!isidchar(INDEX_PCHARP(data, dlen)))
       break;
 
-  s = begin_wide_shared_string(dlen, data.shift);
-  MEMCPY(s->str, data.ptr, dlen<<data.shift);
-  push_string(end_shared_string(s));
+  if(dlen)
+  {
+    s = begin_wide_shared_string(dlen, data.shift);
+    MEMCPY(s->str, data.ptr, dlen<<data.shift);
+    push_string(end_shared_string(s));
 #ifdef PIKE_DEBUG
-  s = NULL;
+    s = NULL;
 #endif /* PIKE_DEBUG */
-  if((sv=low_mapping_string_lookup(get_builtin_constants(),
-				   sp[-1].u.string)))
-  {
-    pop_stack();
-    push_svalue(sv);
-    res=1;
-  }else if(get_master()) {
+    if((sv=low_mapping_string_lookup(get_builtin_constants(),
+				     sp[-1].u.string)))
+    {
+      pop_stack();
+      push_svalue(sv);
+      res=1;
+    }else if(get_master()) {
+      ref_push_string(this->current_file);
+      SAFE_APPLY_MASTER("resolv",2);
+      
+      res=(throw_value.type!=T_STRING) &&
+	(!(IS_ZERO(sp-1) && sp[-1].subtype == NUMBER_UNDEFINED));
+    }else{
+      res=0;
+    }
+  }else{
+    /* Handle contant(.foo) */
+    push_text(".");
     ref_push_string(this->current_file);
-    SAFE_APPLY_MASTER("resolv",2);
-
+    SAFE_APPLY_MASTER("handle_import",2);
+    
     res=(throw_value.type!=T_STRING) &&
       (!(IS_ZERO(sp-1) && sp[-1].subtype == NUMBER_UNDEFINED));
-  }else{
-    res=0;
   }
 
   while(1)
-- 
GitLab