Esempio n. 1
0
        internal ScriptCallContext(ScriptCallContext parent, IFileProcedure procedure, ContextLogOption callLoggingOption, bool isDynamicCall)
        {
            m_task          = parent.m_task;
            m_parentContext = parent;

            m_taskManager          = parent.m_taskManager;
            m_callLoggingOption    = callLoggingOption;
            m_loggerOnEntry        = parent.Logger;
            m_loggerInside         = m_loggerOnEntry;
            m_statusUpdaterOnEntry = parent.StatusUpdater;
            m_loggingEnabled       = parent.LoggingEnabled;
            m_errorListener        = parent.m_errorListener;

            m_procedure     = procedure;
            m_isDynamicCall = isDynamicCall;
            this.SetupFromProcedure();

            m_currentReports = parent.m_currentReports; // Simply inherit the list.

            //m_createdlogger = logger.LogEntering(procedure.ElementName, procedure.Purpose);
            //if (separateStateLevel)
            //{
            //    m_currentStatusUpdater = parent.StatusUpdate.CreateSubTaskStatusReporter(procedure.Purpose);
            //    m_currentStatusUpdater.Disposed += M_currentStatusUpdater_Disposed;
            //    m_createdStatusUpdaters = new Stack<ITaskStatusUpdate>(4);
            //    m_createdStatusUpdaters.Push(m_currentStatusUpdater);
            //}
            //else
            //{
            //    m_currentStatusUpdater = parent.StatusUpdate;
            //}
        }
Esempio n. 2
0
 public void Setup(
     ILogger logger,
     ContextLogOption callerLoggingOption,
     IExecutionScopeStatusUpdate statusUpdate,
     ILoadedFilesManager loadedFilesManager,
     TaskManager taskManager)
 {
     m_logger             = logger;
     m_logOption          = callerLoggingOption;
     m_statusUpdate       = statusUpdate;
     m_loadedFilesManager = loadedFilesManager;
     m_taskManager        = taskManager;
 }
Esempio n. 3
0
 internal ScriptCallContext(
     ScriptTaskContext task,
     ILogger logger,
     ContextLogOption callLoggingOption,
     IExecutionScopeStatusUpdate statusUpdater,
     IFileProcedure procedure,
     TaskManager taskManager)
 {
     m_task                 = task;
     m_parentContext        = null;
     m_callLoggingOption    = callLoggingOption;
     m_loggerInside         = m_loggerOnEntry = logger;
     m_statusUpdaterOnEntry = statusUpdater;
     m_loggingEnabled       = true; // Initial
     m_procedure            = procedure;
     m_taskManager          = taskManager;
     m_isDynamicCall        = false;
     this.SetupFromProcedure();
 }
Esempio n. 4
0
 public FileProcedure(
     IScriptFile file,
     AccessModifier access,
     int line,
     IFileElement parentElement,
     string @namespace,
     string name,
     ContextLogOption logOption = ContextLogOption.Normal,
     bool separateStateLevel    = true) :
     base(file, line, parentElement, @namespace, name, access, FileElementType.ProcedureDeclaration)
 {
     m_callContextParameter = Expression.Parameter(typeof(ICallContext), "callcontext");
     //var delegatetype = (m_runtimeProcedure != null) ? m_runtimeProcedure.GetType() : typeof(UnresolvedProcedureType);
     //m_parametersInternal.Add(new IdentifierInfo("callcontext", "callcontext", IdentifierType.Parameter, delegatetype, m_callContextParameter));
     m_returnLabel  = Expression.Label();
     this.LogOption = logOption;
     this.Flags     =
         (this.Flags & ProcedureFlags.SeparateStateLevel) |
         (separateStateLevel ? ProcedureFlags.SeparateStateLevel : ProcedureFlags.None);
 }
 public IScriptCallContext EnterNewScriptContext(IFileProcedure procedure, ContextLogOption procedureLoggingOption, bool isDynamicCall)
 {
     throw new NotImplementedException();
 }
Esempio n. 6
0
 public IScriptCallContext EnterNewScriptContext(IProcedureReference procedure, ContextLogOption callerLoggingOption, bool isDynamicCall)
 {
     return(this.EnterNewScriptContext(procedure.ProcedureData, callerLoggingOption, isDynamicCall));
 }
Esempio n. 7
0
 public virtual IScriptCallContext EnterNewScriptContext(IFileProcedure procedure, ContextLogOption callerLoggingOption, bool isDynamicCall)
 {
     return(new ScriptCallContext(this, procedure, callerLoggingOption, isDynamicCall));
 }
Esempio n. 8
0
        public static bool GetContextLoggingState(bool callerLogging, bool isDebugging, ContextLogOption callOption, ContextLogOption procedureOption)
        {
            // ForceAlways, Normal, DebugOnly, Disabled

            if (callOption == ContextLogOption.ForceAlways || procedureOption == ContextLogOption.ForceAlways)
            {
                return(true);
            }
            else if (callOption == ContextLogOption.Disabled || procedureOption == ContextLogOption.Disabled)
            {
                return(false);
            }
            else if (callOption == ContextLogOption.DebugOnly || procedureOption == ContextLogOption.DebugOnly)
            {
                return(callerLogging && isDebugging);
            }
            else
            {
                return(callerLogging);
            }
        }
Esempio n. 9
0
        internal static IProcedureReference <T> Create <T>(IScriptFile file, string @namespace, string name, ContextLogOption logOption, T runtime) where T : class
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }
            if (runtime == null)
            {
                throw new ArgumentNullException("runtime");
            }
            var fp = new FileProcedure(file, AccessModifier.Public, -1, null, @namespace, name, logOption, true);

            fp.SetRuntimeProcedure(runtime as Delegate);
            var referenceType = typeof(Reference <>).MakeGenericType(typeof(T));

            fp.m_reference = (IProcedureReference)Activator.CreateInstance(referenceType, fp);
            return(fp.m_reference as IProcedureReference <T>);
        }