/// <summary> /// NCalc custom function evaluator /// </summary> /// <param name="name">name of the function to be evaluated</param> /// <param name="args">FunctionArgs object from where the function arguments will be read and the function evaluation result will be stored</param> private void EvaluateFunction(string name, FunctionArgs args) { if (name == "defined") { //it is here assumed that defined always takes one argument and is of type identifier Identifier identifier = (Identifier)args.Parameters[0].ParsedExpression; args.Result = _definesHandler.IsDefined(identifier.Name); } }
/// <summary> /// Acquires the pre-processor definitions used by the project /// </summary> /// <param name="projectInfo">The Visual Studio project</param> /// <returns>The pre-processor definitions specified within the project</returns> private static Defines GetDefines(ProjectInfo projectInfo) { /* * it is important that the pre-processor defines at project level are not modified * because every source file in the project has to have the same starting point. */ //call to cpy ctor Defines defines = new Defines(projectInfo.DefinesHandler); // Additional Boost definitions // NOTE These definitions are generally assumed to be available since // we are operating in a BOOST Test context if (!defines.IsDefined("BOOST_VERSION")) { defines.Define("BOOST_VERSION", "0"); } return(defines); }