cscope Analyzed Flow - Handling of tag commands and tag stack by do_tag

/*
 * Jump to tag; handling of tag commands and tag stack
 *
 * *tag != NUL: ":tag {tag}", jump to new tag, add to tag stack
 *
 * type == DT_TAG:  ":tag [tag]", jump to newer position or same tag again
 * type == DT_HELP: like DT_TAG, but don't use regexp.
 * type == DT_POP:  ":pop" or CTRL-T, jump to old position
 * type == DT_NEXT: jump to next match of same tag
 * type == DT_PREV: jump to previous match of same tag
 * type == DT_FIRST:    jump to first match of same tag
 * type == DT_LAST: jump to last match of same tag
 * type == DT_SELECT:   ":tselect [tag]", select tag from a list of all matches
 * type == DT_JUMP: ":tjump [tag]", jump to tag or select tag from a list
 * type == DT_CSCOPE:   use cscope to find the tag
 * type == DT_LTAG: use location list for displaying tag matches
 * type == DT_FREE: free cached matches
 *
 * for cscope, returns TRUE if we jumped to tag or aborted, FALSE otherwise
 */
    int
do_tag(tag, type, count, forceit, verbose)
    char_u  *tag;       /* tag (pattern) to jump to */
    int     type;
    int     count;
    int     forceit;    /* :ta with ! */

    int     verbose;    /* print "tag not found" message */

Cscope tag: phy_connect_direct
   #   line  filename / context / line
   1    419  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec.1/apps_proc/kernel/msm-3.18/drivers/net/phy/phy_device.c
             <<GLOBAL>>
             int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
   2    436  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec.1/apps_proc/kernel/msm-3.18/drivers/net/phy/phy_device.c
             <<GLOBAL>>
             EXPORT_SYMBOL(phy_connect_direct);
   3    471  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec.1/apps_proc/kernel/msm-3.18/drivers/net/phy/phy_device.c
             <<GLOBAL>>
             rc = phy_connect_direct(dev, phydev, handler, interface);
   4    229  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec.1/apps_proc/kernel/msm-3.18/drivers/of/of_mdio.c <<GLOBAL>>
             return phy_connect_direct(dev, phy, hndlr, iface) ? NULL : phy;
   5    711  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec.1/apps_proc/kernel/msm-3.18/include/linux/phy.h <<GLOBAL>>
             int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
   6    361  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec.1/apps_proc/kernel/msm-3.18/drivers/net/ethernet/8390/ax88796.c
             <<ax_mii_probe>>
             ret = phy_connect_direct(dev, phy_dev, ax_handle_link_change,
   7   1294  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec....s_proc/kernel/msm-3.18/drivers/net/ethernet/aeroflex/greth.c
             <<greth_mdio_probe>>
             ret = phy_connect_direct(dev, phy, &greth_link_change,
   8    720  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec....ernel/msm-3.18/drivers/net/ethernet/altera/altera_tse_main.c
             <<connect_local_phy>>
             ret = phy_connect_direct(dev, phydev, &altera_tse_adjust_link,
   9    602  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec....roc/kernel/msm-3.18/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
             <<xgbe_phy_init>>
             ret = phy_connect_direct(netdev, phydev, &xgbe_adjust_link,
  10   2205  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec....rnel/msm-3.18/drivers/net/ethernet/broadcom/genet/bcmgenet.c
             <<bcmgenet_open>>
             phy_connect_direct(dev, priv->phydev, bcmgenet_mii_setup,
  11    335  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec.1/apps_proc/kernel/msm-3.18/drivers/net/ethernet/cadence/macb.c
             <<macb_mii_probe>>
             ret = phy_connect_direct(dev, phydev, &macb_handle_link_change,
  12    683  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec.1/apps_proc/kernel/msm-3.18/drivers/net/ethernet/ethoc.c
             <<ethoc_mdio_probe>>
             err = phy_connect_direct(dev, phy, ethoc_mdio_poll,
  13   1900  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec....rnel/msm-3.18/drivers/net/ethernet/qualcomm/emac/emac_main.c
             <<emac_mac_up>>
             ret = phy_connect_direct(netdev, adpt->phydev, emac_adjust_link,
  14   1027  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec....ps_proc/kernel/msm-3.18/drivers/net/ethernet/smsc/smsc911x.c
             <<smsc911x_mii_probe>>
             ret = phy_connect_direct(dev, phydev, &smsc911x_phy_adjust_link,
  15    494  /media/root/work/jllproject/Mangov2/branches/L170HQL2_Wisec.1/apps_proc/kernel/msm-3.18/net/dsa/slave.c
-- More --

列表中的每一项,使用如下数据结构进行表示, 主要是为了支持滚动菜单(scroll back),因此缩写为sb

/*
 * To be able to scroll back at the "more" and "hit-enter" prompts we need to
 * store the displayed text and remember where screen lines start.
 */
typedef struct msgchunk_S msgchunk_T;
struct msgchunk_S
{
    msgchunk_T  *sb_next;
    msgchunk_T  *sb_prev;
    char    sb_eol;     /* TRUE when line ends after this text */
    int     sb_msg_col; /* column in which text starts */
    int     sb_attr;    /* text attributes */
    char_u  sb_text[1]; /* text to be displayed, actually longer */
};

这个菜单项的模型如下:

NULL<---sb_prev-|============|<---sb_prev-|============|<---sb_prev-|============|
                | msgchunk_T |            | msgchunk_T |            | msgchunk_T |
                |            |            |            |            |            |
                |============|-sb_next--->|============|-sb_next--->|==============|-sb_next--->NULL

      (1).各个菜单项通过 sb_prev和sb_next实现双向链接的组织结构。

      (2).sb_eol为TRUE时表示当前代表的菜单项是最后一项,这样设计的好处是:

                通过sb_prev和sb_next可以组织很长的菜单项,比如100个项,但是屏幕显示大小并不能一次完全地显

                示这100项,这时需要分页显示,而每个页的最后一项,总要作下标记,于是需要设计sb_eol表示一屏幕

                页的最后一项。


在已显示的文本中移到屏幕行的开始处.

/*
 * Move to the start of screen line in already displayed text.
 */
    static msgchunk_T *
msg_sb_start(mps)
    msgchunk_T *mps;


重新显示所有行: 

     先清除再显示每个msgchunk_T

            /* redisplay all lines */
            screenclear();
            for (i = 0; mp != NULL && i < Rows - 1; ++i)
            {
                mp = disp_sb_line(i, mp);
                ++msg_scrolled;
            }



--------------------------  新需求 ---------------------

do_more_prompt()

---> case '/': break;  尝试去加个/模式,表示从当前匹配表中再次罗列出所匹配的msgchunk_T.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值