From ece32001a4572b45d61d51805cfc31481d3a632c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Mon, 2 Aug 1999 17:45:13 -0700
Subject: [PATCH] new opcode F_UNDEFINED

Rev: src/docode.c:1.49
Rev: src/interpreter.h:1.8
Rev: src/language.yacc:1.120
Rev: src/lex.c:1.65
---
 src/docode.c      | 9 +++++++--
 src/interpreter.h | 1 +
 src/language.yacc | 3 ++-
 src/lex.c         | 3 ++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/docode.c b/src/docode.c
index 439423e87d..7b276ac050 100644
--- a/src/docode.c
+++ b/src/docode.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: docode.c,v 1.48 1999/06/19 19:57:31 hubbe Exp $");
+RCSID("$Id: docode.c,v 1.49 1999/08/03 00:45:09 hubbe Exp $");
 #include "las.h"
 #include "program.h"
 #include "language.h"
@@ -1078,7 +1078,12 @@ static int do_docode2(node *n,int flags)
     switch(n->u.sval.type)
     {
     case T_INT:
-      emit(F_NUMBER,n->u.sval.u.integer);
+      if(!n->u.sval.u.integer && n->u.sval.subtype==NUMBER_UNDEFINED)
+      {
+	emit2(F_UNDEFINED);
+      }else{
+	emit(F_NUMBER,n->u.sval.u.integer);
+      }
       return 1;
 
     case T_STRING:
diff --git a/src/interpreter.h b/src/interpreter.h
index c1bd510c32..fc365b6bf4 100644
--- a/src/interpreter.h
+++ b/src/interpreter.h
@@ -113,6 +113,7 @@ static int eval_instruction(unsigned char *pc)
       CASE(F_LDA); accumulator=GET_ARG(); break;
 
       /* Push number */
+      CASE(F_UNDEFINED); push_int(0); sp[-1].subtype=NUMBER_UNDEFINED; break;
       CASE(F_CONST0); push_int(0); break;
       CASE(F_CONST1); push_int(1); break;
       CASE(F_CONST_1); push_int(-1); break;
diff --git a/src/language.yacc b/src/language.yacc
index b62a5cfbfd..b34c32dafd 100644
--- a/src/language.yacc
+++ b/src/language.yacc
@@ -47,6 +47,7 @@
 %token F_CLEAR_STRING_SUBTYPE
 %token F_CONSTANT F_FLOAT F_STRING F_ARROW_STRING
 %token F_NUMBER F_NEG_NUMBER F_CONST_1 F_CONST0 F_CONST1 F_BIGNUM
+%token F_UNDEFINED
 /*
  * These are the predefined functions that can be accessed from Pike.
  */
@@ -181,7 +182,7 @@
 /* This is the grammar definition of Pike. */
 
 #include "global.h"
-RCSID("$Id: language.yacc,v 1.119 1999/07/19 00:32:41 hubbe Exp $");
+RCSID("$Id: language.yacc,v 1.120 1999/08/03 00:45:12 hubbe Exp $");
 #ifdef HAVE_MEMORY_H
 #include <memory.h>
 #endif
diff --git a/src/lex.c b/src/lex.c
index f8ccb47d30..5ffa2ce90d 100644
--- a/src/lex.c
+++ b/src/lex.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: lex.c,v 1.64 1999/03/11 13:44:32 hubbe Exp $");
+RCSID("$Id: lex.c,v 1.65 1999/08/03 00:45:13 hubbe Exp $");
 #include "language.h"
 #include "array.h"
 #include "lex.h"
@@ -185,6 +185,7 @@ struct keyword instr_names[]=
 { "number",             F_NUMBER, I_HASARG },
 { "pop",		F_POP_VALUE,0 },	
 { "pop_n_elems",        F_POP_N_ELEMS, I_HASARG },
+{ "push UNDEFINED",     F_UNDEFINED,0 },
 { "push 0",             F_CONST0,0 },
 { "push 1",             F_CONST1,0 },
 { "push 0x7fffffff",    F_BIGNUM,0 },
-- 
GitLab