Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 'emulate sh -c' and $0



On Jun 3,  6:54pm, Richard Hansen wrote:
}
}       else if the function was not defined under an emulation mode but
}       we're currently running under an emulation mode:
}           1. back up the current_option_state pointer
}           2. set current_option_state to point to global_option_state
}           3. call the function
}           4. restore current_option_state

The flaw in this model is that (1) there is no global option state object,
only a local state object on the C call stack that represents the global
state at the time the function was entered; and (2) even if there were a
global state, pointing to that would still be wrong; what you want is to
point to (i.e., overwrite the current global state with) the option state
from one frame earlier in the call stack.

Next you have the issue of the LOCAL_OPTIONS option, and what that means
to your emulated state when that is not set in the frame from which you
restored.



Messages sorted by: Reverse Date, Date, Thread, Author