zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: 'emulate sh -c' and $0
Date: Tue, 03 Jun 2014 18:23:44 -0700	[thread overview]
Message-ID: <140603182344.ZM28117@torch.brasslantern.com> (raw)
In-Reply-To: <538E5212.6000506@bbn.com>

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.


      parent reply	other threads:[~2014-06-04  1:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29 23:04 Richard Hansen
2014-05-30  3:45 ` Bart Schaefer
2014-05-30  8:49   ` Richard Hansen
2014-05-30 17:00     ` Bart Schaefer
2014-05-30 21:14       ` Richard Hansen
2014-05-31  5:13         ` Bart Schaefer
2014-05-31 23:47           ` Bart Schaefer
2014-06-03 20:15           ` Richard Hansen
2014-06-03 20:26             ` Peter Stephenson
2014-06-03 21:10               ` Bart Schaefer
2014-06-03 23:35                 ` Richard Hansen
2014-06-04  0:09                   ` Bart Schaefer
2014-06-03 21:21             ` Bart Schaefer
2014-06-03 22:54               ` Richard Hansen
2014-06-04  0:03                 ` Bart Schaefer
2014-06-04  1:10                   ` Bart Schaefer
2014-06-04  1:23                 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=140603182344.ZM28117@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).