Here is an updated macro since last posted [The method to get enumc members was posted somewhere in the web - not mine] :
_command void VerifyEnumMembers() name_info(',')
{
struct VS_TAG_BROWSE_INFO cm;
_UpdateContext(true);
int status = tag_get_browse_info("", cm,true);
if(!status) {
tag_browse_info_dump(cm,"Enum test",0);
say('Tag Database is 'cm.tag_database);
}
/* if we are in a enum block */
_str type_name = cm.type_name;
_str member_name = cm.member_name;
if(cm.type_name == "typedef") {
_str temp[];
split(cm.return_type," ",temp);
switch(temp[0]) {
case "struct":
{
type_name = "struct";
break;
}
case "enum":
{
type_name = "enum";
break;
}
}
if(temp[1] != cm.member_name) {
/* Not an anonymous enum */
member_name = temp[1];
}
}
say(" Type Name is ="type_name)
switch(type_name) {
case "enum":
{
_str file_name, class_name;
int line_no, tag_flags;
typeless tag_files = p_window_id.tags_filenamea(p_window_id.p_LangId);
int i=0;
for (;;) {
_str tf = next_tag_filea(tag_files, i, false, true);
if (tf == '')
break;
int status = tag_find_in_class(member_name);
say(member_name" 's status is "status);
while (!status) {
tag_get_info(tag_name, type_name, file_name, line_no, class_name, tag_flags);
if (type_name == "enumc") {
// Only pick up enum members.
say(' Enumerated Value : 'tag_name' found at 'line_no);
// enum_members[enum_members._length()] = tag_name;
}
else
{
say(' Found :'tag_name' with type 'type_name);
}
status = tag_next_in_class();
}
}
}
}
}
This code works only with the symbols tagged in a database. If I open a new .h file, fill it with an enum and try this, it doesnt work. But the treeview is able to display the symbols from the new .h file correctly. So is there a way I can achieve what I am doing above with or without having the source code tagged?