diff options
author | nop <nop> | 1997-03-08 06:25:39 +0000 |
---|---|---|
committer | nop <nop> | 1997-03-08 06:25:39 +0000 |
commit | 46996fdbd06907c0036a21a7e21f28f0efde1530 (patch) | |
tree | aa970803c644bdfb2c74c2afa62d6ec82d897919 | |
parent | e6d92fbbd39ec6b819f4712417b6f05684e068db (diff) | |
download | moo-46996fdbd06907c0036a21a7e21f28f0efde1530.tar.gz moo-46996fdbd06907c0036a21a7e21f28f0efde1530.tar.xz moo-46996fdbd06907c0036a21a7e21f28f0efde1530.zip |
1.8.0p6 merge by hand.SAFE.OPTS
-rw-r--r-- | execute.c | 40 | ||||
-rw-r--r-- | numbers.c | 24 | ||||
-rw-r--r-- | program.c | 14 | ||||
-rw-r--r-- | tasks.c | 11 | ||||
-rw-r--r-- | version.c | 2 |
5 files changed, 59 insertions, 32 deletions
@@ -88,7 +88,7 @@ static Var *rt_stack_quick; #define RT_STACK_QUICKSIZE 15 static void -alloc_rt_stack(activation *a, int size) +alloc_rt_stack(activation * a, int size) { Var *res; @@ -103,7 +103,7 @@ alloc_rt_stack(activation *a, int size) } static void -free_rt_stack(activation *a) +free_rt_stack(activation * a) { Var *stack = a->base_rt_stack; @@ -678,7 +678,7 @@ bi_prop_protected(enum bi_prop prop, Objid progr) **/ static enum outcome -run(enum error resumption_error, Var * result) +run(char raise, enum error resumption_error, Var * result) { /* runs the_vm */ /* If the returned value is OUTCOME_DONE and RESULT is non-NULL, then * *RESULT is the value returned by the top frame. @@ -757,7 +757,7 @@ do { \ LOAD_STATE_VARIABLES(); - if (resumption_error != E_NONE) { + if (raise) { error_bv = bv; PUSH_ERROR(resumption_error); } @@ -2029,7 +2029,13 @@ setup_task_execution_limits(int seconds, int ticks) } enum outcome -run_interpreter(enum error e, Var * result, int is_fg, int do_db_tracebacks) +run_interpreter(char raise, enum error e, + Var * result, int is_fg, int do_db_tracebacks) + /* raise is boolean, true iff an error should be raised. + e is the specific error to be raised if so. + (in earlier versions, an error was raised iff e != E_NONE, + but now it's possible to raise E_NONE on resumption from + suspend().) */ { enum outcome ret; @@ -2045,7 +2051,7 @@ run_interpreter(enum error e, Var * result, int is_fg, int do_db_tracebacks) handler_verb_args = zero; handler_verb_name = 0; interpreter_is_running = 1; - ret = run(e, result); + ret = run(raise, e, result); interpreter_is_running = 0; task_timed_out = 0; cancel_timer(task_alarm_id); @@ -2134,7 +2140,7 @@ do_task(Program * prog, int which_vector, Var * result, int do_db_tracebacks) RUN_ACTIV.bi_func_pc = 0; RUN_ACTIV.temp.type = TYPE_NONE; - return run_interpreter(E_NONE, result, !forked, do_db_tracebacks); + return run_interpreter(0, E_NONE, result, !forked, do_db_tracebacks); } /* procedure to resume an old task */ @@ -2154,12 +2160,12 @@ resume_from_previous_vm(vm the_vm, Var v, task_kind kind, Var * result) free_vm(the_vm, 0); if (v.type == TYPE_ERR) - return run_interpreter(v.v.err, result, 0, 1); + return run_interpreter(1, v.v.err, result, 0, 1); else { /* PUSH_REF(v) */ *(RUN_ACTIV.top_rt_stack++) = var_ref(v); - return run_interpreter(E_NONE, result, 0, 1); + return run_interpreter(0, E_NONE, result, 0, 1); } } @@ -2815,11 +2821,14 @@ read_activ(activation * a, int which_vector) char rcsid_execute[] = "$Id$"; /* $Log$ -/* Revision 1.5 1997/03/05 08:41:47 bjj -/* A few malloc-friendly changes: rt_stacks are now centrally allocated/freed -/* so that we can keep a pool of them handy. rt_envs are similarly pooled. -/* Both revert to malloc/free for large requests. +/* Revision 1.6 1997/03/08 06:25:39 nop +/* 1.8.0p6 merge by hand. /* + * Revision 1.5 1997/03/05 08:41:47 bjj + * A few malloc-friendly changes: rt_stacks are now centrally allocated/freed + * so that we can keep a pool of them handy. rt_envs are similarly pooled. + * Both revert to malloc/free for large requests. + * * Revision 1.4 1997/03/03 09:03:31 bjj * 3 opcode optimizations: * @@ -2845,6 +2854,11 @@ char rcsid_execute[] = "$Id$"; * Revision 1.1.1.1 1997/03/03 03:44:59 nop * LambdaMOO 1.8.0p5 * + * Revision 2.11 1997/03/04 04:31:48 eostrom + * Modified run() and run_interpreter() to take a separate argument + * indicating whether to raise an exception, rather than assuming E_NONE + * means no and anything else means yes. + * * Revision 2.10 1996/04/19 01:24:40 pavel * Added support for built-in functions making tail calls to MOO verbs and * changed pass() to use the new feature. Added patches to allow generation @@ -35,16 +35,10 @@ static int parse_number(const char *str, int *result, int try_floating_point) { char *p; - int negative = 0; - while (*str && *str == ' ') - str++; - if (*str == '-') { - str++; - negative = 1; - } *result = strtol(str, &p, 10); - if (try_floating_point && (*p == '.' || *p == 'e' || *p == 'E')) + if (try_floating_point && + (p == str || *p == '.' || *p == 'e' || *p == 'E')) *result = (int) strtod(str, &p); if (p == str) return 0; @@ -53,8 +47,6 @@ parse_number(const char *str, int *result, int try_floating_point) return 0; p++; } - if (negative) - *result = -*result; return 1; } @@ -718,12 +710,20 @@ register_numbers(void) char rcsid_numbers[] = "$Id$"; /* $Log$ -/* Revision 1.2 1997/03/03 04:19:11 nop -/* GNU Indent normalization +/* Revision 1.3 1997/03/08 06:25:42 nop +/* 1.8.0p6 merge by hand. /* + * Revision 1.2 1997/03/03 04:19:11 nop + * GNU Indent normalization + * * Revision 1.1.1.1 1997/03/03 03:45:00 nop * LambdaMOO 1.8.0p5 * + * Revision 2.6 1997/03/04 04:34:06 eostrom + * parse_number() now trusts strtol() and strtod() more instead of + * parsing for "-" itself, since a bug in that led to inputs like "--5" + * and "-+5" being treated as valid. + * * Revision 2.5 1996/03/19 07:15:27 pavel * Fixed floatstr() to allow DBL_DIG + 4 digits. Release 1.8.0p2. * @@ -90,8 +90,8 @@ free_program(Program * p) if (p->ref_count == 0) { for (i = 0; i < p->num_literals; i++) - if (p->literals[i].type == TYPE_STR) /* will not be a LIST */ - free_str(p->literals[i].v.str); + /* can't be a list--strings and floats need to be freed, though. */ + free_var(p->literals[i]); if (p->literals) myfree(p->literals, M_LIT_LIST); @@ -113,12 +113,18 @@ free_program(Program * p) char rcsid_program[] = "$Id$"; /* $Log$ -/* Revision 1.2 1997/03/03 04:19:17 nop -/* GNU Indent normalization +/* Revision 1.3 1997/03/08 06:25:42 nop +/* 1.8.0p6 merge by hand. /* + * Revision 1.2 1997/03/03 04:19:17 nop + * GNU Indent normalization + * * Revision 1.1.1.1 1997/03/03 03:45:01 nop * LambdaMOO 1.8.0p5 * + * Revision 2.4 1997/03/04 04:36:18 eostrom + * Fixed memory leak in free_program(). + * * Revision 2.3 1996/04/08 00:41:16 pavel * Corrected an error in the computation of `program_bytes()'. * Release 1.8.0p3. @@ -210,6 +210,7 @@ find_tqueue(Objid player, int create_if_not_found) deactivate_tqueue(tq); tq->player = player; + tq->handler = 0; tq->connected = 0; tq->first_input = tq->first_bg = 0; @@ -1936,12 +1937,18 @@ register_tasks(void) char rcsid_tasks[] = "$Id$"; /* $Log$ -/* Revision 1.2 1997/03/03 04:19:31 nop -/* GNU Indent normalization +/* Revision 1.3 1997/03/08 06:25:43 nop +/* 1.8.0p6 merge by hand. /* + * Revision 1.2 1997/03/03 04:19:31 nop + * GNU Indent normalization + * * Revision 1.1.1.1 1997/03/03 03:45:01 nop * LambdaMOO 1.8.0p5 * + * Revision 2.9 1997/03/04 04:39:48 eostrom + * Fixed uninitialized handler slot in find_tqueue. + * * Revision 2.8 1996/04/08 01:03:04 pavel * Fixed panic when input was processed for an invalid positive object. * Fixed panic when input would `log in' an unconnected negative object. @@ -40,7 +40,7 @@ #include "config.h" #include "version.h" -const char *server_version = "1.8.0p5"; +const char *server_version = "1.8.0p6"; int check_version(DB_Version version) |