Specman list伪方法从特定索引弹出/推送到特定索引

Specman list伪方法从特定索引弹出/推送到特定索引,specman,Specman,我正在寻找一种实现新列表pseud方法的方法,该方法将 从列表中的特定位置(不一定从索引0)推送/弹出 有没有添加列表伪方法的方法?实现列表伪方法不能使用宏。 下面是一个fpr示例,说明如何实现所需的pop from index pseudo方法: define <my_n_pop'exp> "<list'exp>[ ].[ ]pop_index[ ]\(<num'exp>\)" as { evaluate typeof_item(<list'exp

我正在寻找一种实现新列表pseud方法的方法,该方法将 从列表中的特定位置(不一定从索引0)推送/弹出


有没有添加列表伪方法的方法?

实现列表伪方法不能使用宏。 下面是一个fpr示例,说明如何实现所需的pop from index pseudo方法:

define <my_n_pop'exp> "<list'exp>[ ].[ ]pop_index[ ]\(<num'exp>\)" as {


evaluate typeof_item(<list'exp>) {
    if(<list'exp>.size()> <num'exp>) {
        value = <list'exp>[<num'exp>];
        <list'exp>.delete(<num'exp>);
    }else {
        error("error : This list is has the size of ",<list'exp>.size(),"and you requested item",<num'exp>);
    };
  };
 };

实际上,如果您试图将此宏用于非列表的内容,则使用此宏时确实会收到一条很好的错误消息。它表示类似“表达式‘i’不是列表”的内容,并指向宏和使用宏的源行。
 i=l.pop_index(2); // pop the item with index 2. All greater indices will decrease by 1.