Beispiel #1
0
 //-------------------------------------------------
 //  actual_height
 //-------------------------------------------------
 public float actual_height()
 {
     if (!m_lines.empty())
     {
         return(m_lines.back().yoffset() + m_lines.back().height());
     }
     else
     {
         return(0.0f);
     }
 }
Beispiel #2
0
        protected void error(string errs)  //void ptoken_reader::error(const perrmsg &errs)
        {
            string s           = "";
            string trail       = "                 from ";
            string trail_first = "In file included from ";
            string e           = new plib.pfmt("{0}:{1}:0: error: {2}\n")
                                 .op(m_source_location.back().file_name(), m_source_location.back().line(), errs);

            m_source_location.pop_back();
            while (!m_source_location.empty())
            {
                if (m_source_location.size() == 1)
                {
                    trail = trail_first;
                }
                s = new plib.pfmt("{0}{1}:{2}:0\n{3}").op(trail, m_source_location.back().file_name(), m_source_location.back().line(), s);
                m_source_location.pop_back();
            }

            verror("\n" + s + e + " " + m_line + "\n");
        }
Beispiel #3
0
        void error(string err)
        {
            string s           = "";
            string trail       = "                 from ";
            string trail_first = "In file included from ";
            string e           = new plib.pfmt("{0}:{1}:0: error: {2}\n")
                                 .op(m_stack.back().m_name, m_stack.back().m_lineno, err);

            m_stack.pop_back();
            while (!m_stack.empty())
            {
                if (m_stack.size() == 1)
                {
                    trail = trail_first;
                }
                s = new plib.pfmt("{0}{1}:{2}:0\n{3}").op(trail, m_stack.back().m_name, m_stack.back().m_lineno, s);
                m_stack.pop_back();
            }

            throw new pexception("\n" + s + e + " " + m_line + "\n");
        }
Beispiel #4
0
            bool check_if_processed_and_join(analog_net_t n)
            {
                // no need to process rail nets - these are known variables
                if (n.is_rail_net())
                {
                    return(true);
                }

                // First check if it is in a previous group.
                // In this case we need to merge this group into the current group
                if (groupspre.size() > 1)
                {
                    for (size_t i = 0; i < groupspre.size() - 1; i++)
                    {
                        if (plib.container.contains(groupspre[i], n))
                        {
                            // copy all nets
                            foreach (var cn in groupspre[i])
                            {
                                if (!plib.container.contains(groupspre.back(), cn))
                                {
                                    groupspre.back().push_back(cn);
                                }
                            }

                            // clear
                            groupspre[i].clear();
                            return(true);
                        }
                    }
                }

                // if it's already processed - no need to continue
                if (!groupspre.empty() && plib.container.contains(groupspre.back(), n))
                {
                    return(true);
                }

                return(false);
            }
Beispiel #5
0
        public device_state_entry state_add(device_state_entry entry)  //device_state_entry &state_add(std::unique_ptr<device_state_entry> &&entry);
        {
            // append to the end of the list
            m_state_list.push_back(entry);  //m_state_list.push_back(std::move(entry));
            device_state_entry new_entry = m_state_list.back();

            // set the fast entry if applicable
            if (new_entry.index() >= FAST_STATE_MIN && new_entry.index() <= FAST_STATE_MAX && !new_entry.divider())
            {
                m_fast_state[new_entry.index() - FAST_STATE_MIN] = new_entry;
            }

            return(new_entry);
        }
Beispiel #6
0
 void process_net(analog_net_t n)
 {
     if (n.num_cons() == 0)
     {
         return;
     }
     /* add the net */
     groups.back().push_back(n);
     foreach (var p in n.core_terms)
     {
         if (p.is_type(detail.terminal_type.TERMINAL))
         {
             terminal_t   pt        = (terminal_t)p;
             analog_net_t other_net = pt.otherterm.net();
             if (!already_processed(other_net))
             {
                 process_net(other_net);
             }
         }
     }
 }
Beispiel #7
0
        //-------------------------------------------------
        //  add_entry - adds an entry based on an
        //  options_entry
        //-------------------------------------------------
        void add_entry(options_entry opt, bool override_existing = false)
        {
            std.vector <string> names = new std.vector <string>();
            string minimum            = "";
            string maximum            = "";

            // copy in the name(s) as appropriate
            if (opt.name != null)
            {
                // first extract any range
                string namestr = opt.name;
                size_t lparen  = namestr.find_first_of('(', 0);
                if (lparen != npos)
                {
                    size_t dash = namestr.find_first_of('-', lparen + 1);
                    if (dash != npos)
                    {
                        size_t rparen = namestr.find_first_of(')', dash + 1);
                        if (rparen != npos)
                        {
                            minimum = namestr.Substring((int)lparen + 1, (int)(dash - (lparen + 1))).Trim(); //minimum.assign(strtrimspace(std::string_view(&namestr[lparen + 1], dash - (lparen + 1))));
                            maximum = namestr.Substring((int)dash + 1, (int)(rparen - (dash + 1))).Trim();   //maximum.assign(strtrimspace(std::string_view(&namestr[dash + 1], rparen - (dash + 1))));
                            namestr = namestr.Remove((int)lparen, (int)(rparen + 1 - lparen));               //namestr.erase(lparen, rparen + 1 - lparen);
                        }
                    }
                }

                // then chop up any semicolon-separated names
                size_t semi;
                while ((semi = namestr.find_first_of(';')) != npos)
                {
                    names.push_back(namestr.substr(0, semi));

                    // for booleans, add the "-noXYZ" option as well
                    if (opt.type == option_type.BOOLEAN)
                    {
                        names.push_back("no" + names.back());
                    }

                    namestr = namestr.Remove(0, (int)semi + 1);  //namestr.erase(0, semi + 1);
                }

                // finally add the last item
                names.push_back(namestr);
                if (opt.type == option_type.BOOLEAN)
                {
                    names.push_back("no" + names.back());
                }
            }

            // we might be called with an existing entry
            entry existing_entry = null;

            do
            {
                foreach (string name in names)
                {
                    existing_entry = get_entry(name);
                    if (existing_entry != null)
                    {
                        break;
                    }
                }

                if (existing_entry != null)
                {
                    if (override_existing)
                    {
                        remove_entry(existing_entry);
                    }
                    else
                    {
                        return;
                    }
                }
            } while (existing_entry != null);

            // set the default value
            string defdata = opt.defvalue != null ? opt.defvalue : "";

            // create and add the entry
            add_entry(
                names,
                opt.description,
                opt.type,
                defdata,
                minimum,
                maximum);
        }