Author Topic: RC2: More helpful enum hovers?  (Read 2893 times)

os2bird

  • Community Member
  • Posts: 94
  • Hero Points: 11
RC2: More helpful enum hovers?
« on: November 02, 2014, 01:04:20 pm »
Hi!

Slickedit has a very handy feature where it will popup "enum_value = xxx" when I place the mouse over the enum value. I love the feature. But, just now I ran into a little annoying scenario with it. 

I've got an enum listing most of the known x86 instructions.  Every now and then I have to figure out what a certain integer value corresponds to the in the enum.  Here is how it starts off:
Code: [Select]
enum OPCODES
{
    OP_INVALID = 0,
    OP_OPSIZE,
    OP_ADDRSIZE,
    OP_SEG,
    OP_REPNE,
    OP_REPE,
    OP_REX,
    OP_LOCK,
    OP_LAST_PREFIX = OP_LOCK,
    OP_AND,
    OP_ELIPSIS
};
Mouse over OP_LOCK gives me "OP_LOCK = 7", like I want.  While hovering over OP_LAST_PREFIX gives me the unhelpful "OP_LAST_PREFIX = OP_LOCK", and this continue with "OP_AND = OP_LOCK + 1" and so on for the next 680 or so instructions.

Any chance the OP_LOCK could be resolved to a numerical value starting with OP_LAST_PREFIX?  It would be sooo much more helpful.  :-)

Kind Regards,
 bird.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3470
  • Hero Points: 466
Re: RC2: More helpful enum hovers?
« Reply #1 on: November 06, 2014, 12:43:19 am »
In that specific case, yes, but in general no.

enum AnotherEnum {
   VALUE1 = SOME_PREPROCESSOR_DEFINE_NOBODY_KNOWS_WHAT_IT_IS,
   VALUE2,
   VALUE3
};

TKasparek

  • Senior Community Member
  • Posts: 239
  • Hero Points: 28
Re: RC2: More helpful enum hovers?
« Reply #2 on: November 06, 2014, 04:52:40 pm »
I agree this would be super helpful. I've often done something like:
Code: [Select]
enum enum1 {
 VALUE1 = 0,
 VALUE2,
 VALUE3,
 TOTAL_ENUM1_VALUES,
};

enum enum2 {
 VALUE4 = TOTAL_ENUM1_VALUES,
 VALUE5
};
as a way of requiring specific values as parameters in methods but still keeping these values unique within a codeset.

Being able to hover and actually see the value would be very helpful when it can easily be calculated. Like when the symbol exists in only one place.

Regards,
Tom

Tim Kemp

  • Senior Community Member
  • Posts: 537
  • Hero Points: 91
Re: RC2: More helpful enum hovers?
« Reply #3 on: November 07, 2014, 01:21:07 pm »
In that specific case, yes, but in general no.

It seems like displaying both the integer value and, when available, the symbolic value, would be the best way to deal with this. It's not like SlickEdit actually knows which one you want.

Graeme

  • Senior Community Member
  • Posts: 2683
  • Hero Points: 335
Re: RC2: More helpful enum hovers?
« Reply #4 on: November 07, 2014, 01:57:59 pm »
You could change to #define
 
    OP_LOCK,
    #define OP_LAST_PREFIX OP_LOCK
    OP_AND,

or
    OP_LOCK,
    OP_LOCK_CHECK =  1/(OP_LOCK == 7),
    OP_LAST_PREFIX = 7,
    OP_AND,
« Last Edit: November 07, 2014, 01:59:42 pm by Graeme »