diff --git a/bin/hilfe b/bin/hilfe index 5be1e363e83d62a57bb9b06f8c5768578566cdce..282092b4dad5d0f9a59705ef07d20c0dd5ad11c7 100755 --- a/bin/hilfe +++ b/bin/hilfe @@ -63,6 +63,7 @@ object eval(string f) } if(err=catch(o=clone(p))) { + trace(0); write(describe_backtrace(err)); return 0; } @@ -76,6 +77,7 @@ mixed do_evaluate(string a, int show_result) { if(c=catch(a=sprintf("%O",foo->___Foo4711()))) { + trace(0); if(arrayp(c) && sizeof(c)==2 && arrayp(c[1])) { c[1]=c[1][sizeof(backtrace())..]; diff --git a/src/builtin_functions.c b/src/builtin_functions.c index ae891e48af4e102d671b7197742fff5b344d92ab..9071414671387add44a932775f755a83e9c81c62 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.62 1998/01/25 08:25:03 hubbe Exp $"); +RCSID("$Id: builtin_functions.c,v 1.63 1998/01/29 06:02:28 hubbe Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -554,6 +554,7 @@ void f_all_constants(INT32 args) void f_allocate(INT32 args) { INT32 size; + struct array *a; if(args < 1) error("Too few arguments to allocate.\n"); @@ -565,8 +566,15 @@ void f_allocate(INT32 args) size=sp[-args].u.integer; if(size < 0) error("Allocate on negative number.\n"); + a=allocate_array(size); + if(args>1) + { + INT32 e; + for(e=0;e<a->size;e++) + copy_svalues_recursively_no_free(a->item+e, sp-args+1, 1, 0); + } pop_n_elems(args); - push_array( allocate_array(size) ); + push_array(a); } void f_rusage(INT32 args) @@ -1806,7 +1814,7 @@ void init_builtin_efuns(void) add_efun("aggregate_multiset",f_aggregate_multiset,"function(mixed ...:multiset)",OPT_TRY_OPTIMIZE); add_efun("aggregate_mapping",f_aggregate_mapping,"function(mixed ...:mapping)",OPT_TRY_OPTIMIZE); add_efun("all_constants",f_all_constants,"function(:mapping(string:mixed))",OPT_EXTERNAL_DEPEND); - add_efun("allocate", f_allocate, "function(int, string|void:mixed *)", 0); + add_efun("allocate", f_allocate, "function(int, mixed:mixed *)", 0); add_efun("arrayp", f_arrayp, "function(mixed:int)",0); add_efun("backtrace",f_backtrace,"function(:array(array(function|int|string)))",OPT_EXTERNAL_DEPEND); diff --git a/src/interpret.c b/src/interpret.c index 6db1c6c13ee40cd9643a2efcbc35ed01f128b2b3..cadcec7a5697b7c6519b4e4c676d12b0f453122d 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.62 1998/01/26 19:59:53 hubbe Exp $"); +RCSID("$Id: interpret.c,v 1.63 1998/01/29 06:02:28 hubbe Exp $"); #include "interpret.h" #include "object.h" #include "program.h" @@ -608,6 +608,7 @@ static int eval_instruction(unsigned char *pc) sp->subtype=GET_ARG()+fp->context.identifier_level; sp->type=T_FUNCTION; sp++; + print_return_value(); break; /* The not so basic 'push value' instructions */ diff --git a/src/language.yacc b/src/language.yacc index 6f137c8059e55158cbbd366b779252d28ff7708b..21d480f46f7cf185b418e6c06ce0a33e12c85854 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -161,7 +161,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.56 1998/01/27 20:02:14 hubbe Exp $"); +RCSID("$Id: language.yacc,v 1.57 1998/01/29 06:02:29 hubbe Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -918,22 +918,18 @@ lambda: F_LAMBDA type=pop_type(); - if(new_program->flags | PROGRAM_PASS_1_DONE) - { - sprintf(buf,"__lambda_%ld", - (long)new_program->num_identifier_references); - name=make_shared_string(buf); - - f=dooptcode(name, - $4, - type, - ID_PRIVATE); - } + sprintf(buf,"__lambda_%ld",local_class_counter++); + name=make_shared_string(buf); + + f=dooptcode(name, + $4, + type, + ID_PRIVATE); + $$=mkidentifiernode(f); free_string(name); free_string(type); comp_stackp=$<number>2; pop_compiler_frame(); - $$=mkidentifiernode(f); } ; diff --git a/src/lex.c b/src/lex.c index 8dc93d78c4dfb443b044b2bd7ddd007c4f0cff28..cd98754fb8bb81b3dc220507a13eb1c4eecebca9 100644 --- a/src/lex.c +++ b/src/lex.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: lex.c,v 1.41 1998/01/26 19:59:55 hubbe Exp $"); +RCSID("$Id: lex.c,v 1.42 1998/01/29 06:02:29 hubbe Exp $"); #include "language.h" #include "array.h" #include "lex.h" @@ -207,6 +207,7 @@ struct keyword instr_names[]= { "call lfun & return", F_CALL_LFUN_AND_RETURN, I_HASARG }, { "call function", F_CALL_FUNCTION, 0 }, { "call function & return", F_CALL_FUNCTION_AND_RETURN, 0 }, +{ "+= and pop", F_ADD_TO_AND_POP, 0 }, }; struct instr instrs[F_MAX_INSTR - F_OFFSET]; diff --git a/src/testsuite.in b/src/testsuite.in index b7ca74092b33e74776dd1f98140ff213d9360f13..aed59bb9526b9ea31fe63068203b7dda4a5f38f9 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -test_true([["$Id: testsuite.in,v 1.68 1998/01/25 08:25:15 hubbe Exp $"]]) +test_true([["$Id: testsuite.in,v 1.69 1998/01/29 06:02:30 hubbe Exp $"]]) test_eq(1e1,10.0) test_eq(1E1,10.0) test_eq(1e+1,10.0) @@ -475,7 +475,7 @@ test_equal("abcd"/"" - indices("abcd"),({"a","b","c","d"})) test_equal("abcd"/"" & indices("abcd"),({})) test_eq(sizeof("abcd"/"" & "de"/""),1) test_equal( ({0,0,0,0,0}), ({0,0,0,0,0})) -test_equal( ({0,0,0,0,0}), allocate(5,"object")) +test_equal( ({"object","object","object","object","object"}), allocate(5,"object")) test_equal(mkmapping("abcd"/"","jklm"/"") | mkmapping("jclm"/"","alcd"/""), mkmapping("abcdjlm"/"","jklmacd"/"")) test_program(int foo() { return 17;} mixed a() { return foo() == 17; })