Commits

Anonymous committed f2a1d99

Support "duration" property; use when no "after" in "causes".

  • Participants
  • Parent commits 84a15bc

Comments (0)

Files changed (3)

  * OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 /*
- * event.h
+ * event.c
  * Event housekeeping and manipulation for 2Iota.
  * $Id: event.c 518 2010-04-28 17:48:38Z cpressey $
  */
 	e->name = symstr_new();
 	e->head = NULL;
 	e->params = symbol_table_new();
+	e->duration = etime_zero;
 	etab->head = e;
 	return(e);
 }
 	c->next = cause->head;
 	c->effect = effect;
 	if (delay == NULL)
-		c->delay = etime_zero;
+		c->delay = cause->duration;
 	else
 		c->delay = *delay;
 
 	struct symstr		*name;		/* name of event */
 	struct consequence	*head;		/* what happens on trigger */
 	struct symbol_table	*params;	/* local bindings */
+	struct etime		duration;	/* for v1.0 compat */
 };
 
 struct consequence {
 		if (tokeq(sc, "after")) {
 			scan(sc);
 			time_spec(sc, &et);
+			c = event_consequence_append(e, ss, &et);
+		} else {
+			c = event_consequence_append(e, ss, NULL);
 		}
-		c = event_consequence_append(e, ss, &et);
 		while(tokeq(sc, "when")) {
 			scan(sc);
 			when_term(sc, e);
 		}
+	} else if (tokeq(sc, "duration")) {
+		scan(sc);
+		time_spec(sc, &e->duration);
 	} else
 		scan_error(sc, "Expected 'causes'");
 }