Ejemplo n.º 1
0
        public static LibrarySpec Parse(SExpression root_node)
        {
            LibrarySpec result = new LibrarySpec();

            foreach (SExpression node in root_node.Items)
            {
                switch (node.Name)
                {
                case "logical":
                    result.Name = node.GetValue();
                    break;

                case "uri":
                    result.Uri = node.GetValue();
                    break;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public bool LoadFromFile(String Filename)
        {
            bool result = false;

            RootNode = new SExpression();
            RootNode.LoadFromFile(Filename);

            if (RootNode.Name == "export")
            {
                foreach (SNodeBase node in RootNode.Items)
                {
                    if (node is SExpression)
                    {
                        SExpression sexp = node as SExpression;
                        switch (sexp.Name)
                        {
                        case "version":
                            Version = sexp.GetValue();
                            break;

                        case "design":
                            break;

                        case "components":
                        {
                            foreach (SExpression sub_node in sexp.Items)
                            {
                                if (sub_node.Name == "comp")
                                {
                                    ComponentNetlist comp = ComponentNetlist.Parse(sub_node);
                                    if (Components == null)
                                    {
                                        Components = new List <ComponentBase>();
                                    }
                                    Components.Add(comp);
                                }
                            }
                        }
                        break;

                        case "libparts":
                            break;

                        case "libraries":
                        {
                            foreach (SExpression sub_node in sexp.Items)
                            {
                                if (sub_node.Name == "library")
                                {
                                    LibrarySpec lib = LibrarySpec.Parse(sub_node);
                                    if (Libraries == null)
                                    {
                                        Libraries = new List <LibrarySpec>();
                                    }
                                    Libraries.Add(lib);
                                }
                            }
                        }
                        break;

                        case "nets":
                            break;
                        }
                    }
                }
            }

            return(result);
        }