user3612132
user3612132

Reputation: 93

comparing strings by lexicographical order in e/specman

Does specman have something like lex_lt(s1,s2) methods? (i.e. compare strings by lexicographical order). If not, is there a recommended way to achieve the same?

Upvotes: 3

Views: 321

Answers (2)

Semadar
Semadar

Reputation: 105

As far as I know, we don’t have something pre-defined for this. But it can be done, for example, in the following ugly way:

if {s1;s2}.sort(it)[0] == s1 …. // if it’s TRUE, then s1 is less that s2, otherwise not

Of course, as Tudor suggested, the best way will be to define C routine to wrap strcmp().

Upvotes: 1

Tudor Timi
Tudor Timi

Reputation: 7573

It seems that there isn't. You can do 2 things here. You can either implement your own strcmp() style function in e and use that directly, or you can integrate Specman with a C file that wraps strcmp() in function that can be called from your e code. Have a look at the Specman Integrator's Guide section in the product manual for details on how to do this.

Upvotes: 1

Related Questions