示例#1
0
        public static SubModule[] GetAllSubModules(ModuleInfo module)
        {
            NamedTypeList <SubModule> subModules = new NamedTypeList <SubModule>(module.SubModules);

            foreach (GenerateInfo subGen in module.Generates)
            {
                subModules.AddRange(GetSubModules(subGen));
            }
            return(subModules.ToArray());
        }
示例#2
0
        private static SubModule[] GetSubModules(GenerateInfo info)
        {
            NamedTypeList <SubModule> subModules = new NamedTypeList <SubModule>(info.SubModules);

            foreach (GenerateInfo subGen in info.Generates)
            {
                subModules.AddRange(GetSubModules(subGen));
            }
            return(subModules.ToArray());
        }
示例#3
0
        /// <summary>
        ///   Writes the process to a stream.
        /// </summary>
        /// <param name="wr"><see cref="StreamWriter"/> object to write the process to.</param>
        /// <param name="indentOffset">Number of indents to add before any documentation begins.</param>
        /// <exception cref="ArgumentNullException"><paramref name="wr"/> is a null reference.</exception>
        /// <exception cref="InvalidOperationException">No code lines were specified.</exception>
        /// <exception cref="IOException">An error occurred while writing to the <see cref="StreamWriter"/> object.</exception>
        public override void Write(StreamWriter wr, int indentOffset)
        {
            if (wr == null)
            {
                throw new ArgumentNullException("wr");
            }

            if (indentOffset < 0)
            {
                indentOffset = 0;
            }

            if (CodeLines.Count == 0)
            {
                throw new InvalidOperationException(string.Format("An attempt was made to write a process ({0}), but the processes doesn't have any code associated with it", Name));
            }

            // Write the header.
            WriteBasicHeader(wr, indentOffset);
            DocumentationHelper.WriteLine(wr, string.Format("{0}:", Name), indentOffset);
            DocumentationHelper.WriteLine(wr, GetSensitivityListLine(), indentOffset);

            // Write the variable declarations out.
            BaseTypeInfo.WriteBaseTypeInfos(null, wr, Variables.ToArray(), indentOffset + 1, Name, "process");

            DocumentationHelper.WriteLine(wr, "begin", indentOffset);

            // Write the code lines.
            foreach (string line in CodeLines)
            {
                DocumentationHelper.WriteLine(wr, line, indentOffset + 1);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("end process");
            if (DefaultValues.AddOptionalNames)
            {
                sb.AppendFormat(" {0}", Name);
            }
            sb.Append(";");
            DocumentationHelper.WriteLine(wr, sb.ToString(), indentOffset);
        }