示例#1
0
        public void Validate(IErrorReporter errorReporter, MODULE module)
        {
            base.ValidateIdentifier(Name, errorReporter);

            if (Conversion != "NO_COMPU_METHOD")
            {
                /* Validate that refered conversion method exists */
                if (!module.CompuMethods.ContainsKey(Conversion))
                {
                    base.reportErrorOrWarning(String.Format("Referenced conversion method '{0} not found", Conversion), false, errorReporter);
                }
            }

            if (ref_memory_segment != null && ref_memory_segment != "")
            {
                /* Validate that refered conversion method exists */

                var mod_par = module.elements.FirstOrDefault(x => x.GetType() == typeof(MOD_PAR)) as MOD_PAR;
                if (mod_par != null)
                {
                    if (!mod_par.memory_segment.ContainsKey(ref_memory_segment))
                    {
                        base.reportErrorOrWarning(String.Format("Referenced MEMORY_SEGMENT '{0} not found", ref_memory_segment), false, errorReporter);
                    }
                }
            }
        }
示例#2
0
        public void Validate(IErrorReporter errorReporter, MODULE module)
        {
            base.ValidateIdentifier(Name, errorReporter);

            {
                /* Validate that refered RECORD_LAYOUT exists */
                if (!module.Record_layouts.ContainsKey(Deposit))
                {
                    base.reportErrorOrWarning(string.Format("Referenced RECORD_LAYOUT '{0}' not found", Conversion), false, errorReporter);
                }
            }

            if (InputQuantity != "NO_INPUT_QUANTITY")
            {
                /* Validate that refered measurement exists */
                if (!module.AxisPtsCharacteristicMeasurement.ContainsKey(InputQuantity))
                {
                    base.reportErrorOrWarning(string.Format("Referenced inputQuantity '{0}' not found", InputQuantity), false, errorReporter);
                }
            }

            /* Validate that refered RECORD_LAYOUT exists */
            if (!module.Record_layouts.ContainsKey(Deposit))
            {
                base.reportErrorOrWarning(string.Format("Referenced Deposit '{0}' not found", Deposit), false, errorReporter);
            }

            if (Conversion != "NO_COMPU_METHOD")
            {
                /* Validate that refered conversion method exists */
                if (!module.CompuMethods.ContainsKey(Conversion))
                {
                    base.reportErrorOrWarning(string.Format("Referenced conversion method '{0}' not found", Conversion), false, errorReporter);
                }
            }

            if (phys_unit != null && phys_unit != "")
            {
                /* Validate that refered UNIT exists */
                if (!module.Units.ContainsKey(phys_unit))
                {
                    base.reportErrorOrWarning(string.Format("Referenced UNIT '{0}' not found", phys_unit), false, errorReporter);
                }
            }

            if (ref_memory_segment != null && ref_memory_segment != "")
            {
                /* Validate that refered conversion method exists */

                var mod_par = module.elements.FirstOrDefault(x => x.GetType() == typeof(MOD_PAR)) as MOD_PAR;
                if (mod_par != null)
                {
                    if (!mod_par.memory_segment.ContainsKey(ref_memory_segment))
                    {
                        base.reportErrorOrWarning(string.Format("Referenced MEMORY_SEGMENT '{0}' not found", ref_memory_segment), false, errorReporter);
                    }
                }
            }
        }
示例#3
0
        public void Validate(IErrorReporter errorReporter, MODULE module)
        {
            base.ValidateIdentifier(Name, errorReporter);

            if (type == Type.DERIVED)
            {
                if (ref_unit == null || ref_unit == "")
                {
                    base.reportErrorOrWarning("DERIVED UNIT must have a referenced UNIT in REF_UNIT", false, errorReporter);
                }

                if (unit_conversion == null)
                {
                    base.reportErrorOrWarning("DERIVED UNIT must have a UNIT_CONVERSION", false, errorReporter);
                }
            }
            else
            {
                if (si_exponents == null)
                {
                    base.reportErrorOrWarning("EXTENDED_SI UNIT must have a SI_EXPONENTS", false, errorReporter);
                }
                if (ref_unit != null && ref_unit != "")
                {
                    base.reportErrorOrWarning("EXTENDED_SI UNIT shall not have a REF_UNIT", false, errorReporter);
                }
            }

            if (ref_unit != null && ref_unit != "")
            {
                /* Validate that refered UNIT exists */
                if (!module.Units.ContainsKey(ref_unit))
                {
                    base.reportErrorOrWarning(string.Format("Referenced UNIT '{0}' in REF_UNIT not found", ref_unit), false, errorReporter);
                }
            }
        }
示例#4
0
        public void Validate(IErrorReporter errorReporter, MODULE module)
        {
            base.ValidateIdentifier(Name, errorReporter);

            if (conversionType == ConversionType.FORM)
            {
                if (formula != null)
                {
                    formula.Validate(errorReporter, module);
                }
                else
                {
                    base.reportErrorOrWarning("COMPU_METHOD with ConversionType FORM requires a FORMULA definition but no FORMULA where defined", false, errorReporter);
                }
            }
            else if (conversionType == ConversionType.LINEAR)
            {
                if (coeffs_linear == null)
                {
                    base.reportErrorOrWarning("COMPU_METHOD with ConversionType LINEAR requires a COEFFS_LINEAR definition but no COEFFS_LINEAR where defined", false, errorReporter);
                }
            }
            else if (conversionType == ConversionType.RAT_FUNC)
            {
                if (coeffs == null)
                {
                    base.reportErrorOrWarning("COMPU_METHOD with ConversionType RAT_FUNC requires a COEFFS definition but no COEFFS where defined", false, errorReporter);
                }
            }
            else if ((conversionType == ConversionType.TAB_INTP) || (conversionType == ConversionType.TAB_NOINTP) || (conversionType == ConversionType.TAB_VERB))
            {
                if (compu_tab_ref == null)
                {
                    base.reportErrorOrWarning(string.Format("COMPU_METHOD with conversionType {0} requires a COMPU_TAB_REF definition but no COMPU_TAB_REF where defined", ConversionType.TAB_VERB.ToString()), false, errorReporter);
                }
                else
                {
                    Asap2Base tab;
                    if (module.CompuTabCompuVtabCompuVtabRanges.TryGetValue(compu_tab_ref, out tab))
                    {
                        if ((conversionType == ConversionType.TAB_INTP) || (conversionType == ConversionType.TAB_NOINTP))
                        {
                            if (tab.GetType() == typeof(COMPU_TAB))
                            {
                                var tmp = (tab as COMPU_TAB);
                                if (tmp.conversionType != conversionType)
                                {
                                    tmp.reportErrorOrWarning(string.Format("ConversionType '{0}' is not the expeced ConversionType '{1}'", tmp.conversionType, conversionType), false, errorReporter);
                                }
                            }
                            else
                            {
                                base.reportErrorOrWarning(string.Format("Reference '{0}' in COMPU_TAB_REF is not of type COMPU_TAB", compu_tab_ref), false, errorReporter);
                            }
                        }
                        else
                        {
                            if (tab.GetType() == typeof(COMPU_VTAB))
                            {
                                var tmp = (tab as COMPU_VTAB);
                                if (tmp.conversionType != conversionType)
                                {
                                    tmp.reportErrorOrWarning(string.Format("ConversionType '{0}' is not the expeced ConversionType '{1}'", tmp.conversionType, conversionType), false, errorReporter);
                                }
                            }
                            else if (tab.GetType() != typeof(COMPU_VTAB_RANGE))
                            {
                                base.reportErrorOrWarning(string.Format("Reference '{0}' in COMPU_TAB_REF is not of type COMPU_VTAB or COMPU_VTAB_RANGE", compu_tab_ref), false, errorReporter);
                            }
                        }
                    }
                    else
                    {
                        base.reportErrorOrWarning(string.Format("Referenced COMPU_TAB '{0}' in COMPU_TAB_REF not found", compu_tab_ref), false, errorReporter);
                    }
                }
            }

            if (ref_unit != null && ref_unit != "")
            {
                /* Validate that refered UNIT exists */
                if (!module.Units.ContainsKey(ref_unit))
                {
                    base.reportErrorOrWarning(string.Format("Referenced UNIT '{0}' in REF_UNIT not found", ref_unit), false, errorReporter);
                }
                if (Unit != "")
                {
                    base.reportErrorOrWarning(string.Format("Both Unit and REF_UNIT is specified, value from REF_UNIT will be used"), false, errorReporter, true);
                }
            }

            if (status_string_ref != null && status_string_ref != "")
            {
                Asap2Base tab;
                if (module.CompuTabCompuVtabCompuVtabRanges.TryGetValue(status_string_ref, out tab))
                {
                    if (tab.GetType() == typeof(COMPU_VTAB))
                    {
                        var tmp = (tab as COMPU_VTAB);
                        if (tmp.conversionType != conversionType)
                        {
                            tmp.reportErrorOrWarning(string.Format("ConversionType '{0}' is not the expected ConversionType '{1}'", tmp.conversionType, ConversionType.TAB_VERB), false, errorReporter);
                        }
                    }
                    else if (tab.GetType() != typeof(COMPU_VTAB_RANGE))
                    {
                        base.reportErrorOrWarning(string.Format("Reference '{0}' in STATUS_STRING_REF is not of type COMPU_VTAB or COMPU_VTAB_RANGE", status_string_ref), false, errorReporter);
                    }
                }
                else
                {
                    base.reportErrorOrWarning(string.Format("Referenced COMPU_VTAB or COMPU_VTAB_RANGE '{0}' in STATUS_STRING_REF not found", status_string_ref), false, errorReporter);
                }
            }
        }