diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-23 19:00:09 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-23 21:56:57 (EST) |
commit | 4dcd94de4bea9d81141ddbb646b650f7241e31c0 (patch) | |
tree | 7d7239079bf01bd52f57b666e21b42997389fb32 | |
parent | 771674c4e360a3700bc2961b98c3cdf7f9b2e170 (diff) | |
download | eggshell-4dcd94de4bea9d81141ddbb646b650f7241e31c0.zip eggshell-4dcd94de4bea9d81141ddbb646b650f7241e31c0.tar.gz eggshell-4dcd94de4bea9d81141ddbb646b650f7241e31c0.tar.bz2 |
eshld/eshrt: Add function begin/end hooks
-rw-r--r-- | eshld/eshrt.esh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/eshld/eshrt.esh b/eshld/eshrt.esh index 7e03ef2..bcc69b4 100644 --- a/eshld/eshrt.esh +++ b/eshld/eshrt.esh @@ -35,6 +35,8 @@ __prev_tu='' __prev_vars='' __var='' __val='' +__fn_begin_hooks='' +__fn_end_hooks='' __init_funcs='' __fn_stack_push() @@ -123,6 +125,11 @@ __fn_update_vars() __fn_start() { + # Hooks. + for __fn in ${__fn_begin_hooks}; do + ${__fn} ${2} + done + # Old state. __prev_tu="${__fn_tu}" __prev_vars="${__fn_vars}" @@ -148,6 +155,11 @@ __fn_start() __fn_end() { + # Hooks. + for __fn in ${__fn_end_hooks}; do + ${__fn} ${__fn_name} + done + # Old state. __fn_stack_pop __fn_frame_decode @@ -233,6 +245,16 @@ static() done } +__fn_begin_hook() +{ + __fn_begin_hooks="${__fn_begin_hooks} ${1}" +} + +__fn_end_hook() +{ + __fn_end_hooks="${__fn_end_hooks} ${1}" +} + __init() { __init_funcs="${__init_funcs} ${1}" |