示例#1
0
        public Value PushCommand(CallScope args)
        {
            // Make a copy at position 2, because the topmost report object has an
            // open output stream at this point.  We want it to get popped off as
            // soon as this command terminate so that the stream is closed cleanly.
            Report temp = ReportStack.Pop();

            ReportStack.Push(new Report(temp));
            ReportStack.Push(temp);
            return(Value.Get(true));
        }
示例#2
0
        public GlobalScope(IDictionary <string, string> envp) : this()
        {
            TimesCommon.Current.Epoch = TimesCommon.Current.CurrentDate;

            Session.SetSessionContext(Session = new Session());

            // Create the report object, which maintains state relating to each
            // command invocation.  Because we're running from main(), the
            // distinction between session and report doesn't really matter, but if
            // a GUI were calling into Ledger it would have one session object per
            // open document, with a separate report_t object for each report it
            // generated.
            ReportStack.Push(new Report(Session));
            Scope.DefaultScope = Report;
            Scope.EmptyScope   = new EmptyScope();

            // Read the user's options, in the following order:
            //
            //  1. environment variables (LEDGER_<option>)
            //  2. initialization file (~/.ledgerrc)
            //  3. command-line (--option or -o)
            //
            // Before processing command-line options, we must notify the session object
            // that such options are beginning, since options like -f cause a complete
            // override of files found anywhere else.
            if (!ArgsOnly)
            {
                Session.FlushOnNextDataFile = true;
                ReadEnvironmentSettings(envp);
                Session.FlushOnNextDataFile = true;
                ReadInit();
            }
            else
            {
                Session.PriceDbHandler.Off();
            }
        }
示例#3
0
 public void PushReport()
 {
     ReportStack.Push(new Report(ReportStack.Peek()));
     Scope.DefaultScope = Report;
 }