예제 #1
0
        /// <summary>
        /// Compiles entry code and body of a sheet-defined function
        /// </summary>
        /// <param name="info">The SdfInfo object describing the function</param>
        /// <returns></returns>
        private static Delegate CompileSdf(SdfInfo info)
        {
            // Build dependency graph containing all cells needed by the output cell
            DependencyGraph dpGraph = new DependencyGraph(info.outputCell,
                                                          info.inputCells,
                                                          delegate(FullCellAddr fca) { return(fca.sheet[fca.ca]); });
            // Topologically sort the graph in calculation order; leave out constants
            IList <FullCellAddr> cellList = dpGraph.PrecedentOrder();

            info.SetVolatility(cellList);
            // Convert each Expr into a CGExpr while preserving order.  Inline single-use expressions
            cellToFunctionMapper.AddFunction(info, dpGraph.GetAllNodes());
            return(ProgramLines.CreateSdfDelegate(info, dpGraph, cellList));
        }
예제 #2
0
파일: SdfManager.cs 프로젝트: Dugin13/P10
 /// <summary>
 /// Compiles entry code and body of a sheet-defined function
 /// </summary>
 /// <param name="info">The SdfInfo object describing the function</param>
 /// <returns></returns>
 private static Delegate CompileSdf(SdfInfo info) {
   // Build dependency graph containing all cells needed by the output cell
   DependencyGraph dpGraph = new DependencyGraph(info.outputCell, info.inputCells,
     delegate(FullCellAddr fca) { return fca.sheet[fca.ca]; });
   // Topologically sort the graph in calculation order; leave out constants
   IList<FullCellAddr> cellList = dpGraph.PrecedentOrder();
   info.SetVolatility(cellList);
   // Convert each Expr into a CGExpr while preserving order.  Inline single-use expressions
   cellToFunctionMapper.AddFunction(info, dpGraph.GetAllNodes());
   return ProgramLines.CreateSdfDelegate(info, dpGraph, cellList);  
 }