From 74b69919c722054a57166f6b77d1f64f6c48f6ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Sun, 26 Jan 1997 17:15:37 -0800
Subject: [PATCH] overloading for `() implemented, optimized plus on strings

Rev: src/interpret.c:1.21
---
 src/interpret.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/interpret.c b/src/interpret.c
index 578d027313..da83adb17e 100644
--- a/src/interpret.c
+++ b/src/interpret.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: interpret.c,v 1.20 1997/01/17 21:06:40 hubbe Exp $");
+RCSID("$Id: interpret.c,v 1.21 1997/01/27 01:15:37 hubbe Exp $");
 #include "interpret.h"
 #include "object.h"
 #include "program.h"
@@ -676,7 +676,7 @@ static void eval_instruction(unsigned char *pc)
        * and then the low array/multiset/mapping manipulation routines can be
        * destructive if they like
        */
-      if( (1 << sp[-1].type) & ( BIT_ARRAY | BIT_MULTISET | BIT_MAPPING ))
+      if( (1 << sp[-1].type) & ( BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING ))
       {
 	struct svalue s;
 	s.type=T_INT;
@@ -1493,6 +1493,21 @@ void strict_apply_svalue(struct svalue *s, INT32 args)
     }
     break;
 
+  case T_OBJECT:
+  {
+    if(!s->u.object->prog)
+      error("Calling a destructed object.\n");
+    
+    if(s->u.object->prog->lfuns[LFUN_CALL] == -1)
+      error("Calling object without `() operator\n");
+
+    apply_lfun(s->u.object, LFUN_CALL, args);
+    free_svalue(sp-2);
+    sp[-2]=sp[-1];
+    sp--;
+    break;
+  }
+
   default:
     error("Call to non-function value.\n");
   }
-- 
GitLab