From c038c9de95584ddb5251607dcdb4f168748a2cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 7 Jun 2006 12:06:11 +0000 Subject: [PATCH] B_PROPERTY_INFO_TYPE now prints out types and compound types minor cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17753 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/hey.cpp | 71 +++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/src/bin/hey.cpp b/src/bin/hey.cpp index b152ca0839..a4bc991680 100644 --- a/src/bin/hey.cpp +++ b/src/bin/hey.cpp @@ -1110,7 +1110,6 @@ format_data(int32 type, char *ptr, long size) float *fptr; double *dptr; // BRect *brptr; - long i; entry_ref aref; BEntry entry; BPath path; @@ -1123,11 +1122,6 @@ format_data(int32 type, char *ptr, long size) uint16 ui16; uint8 ui8; BMessage anothermsg; - BPropertyInfo propinfo; - const property_info *pinfo; - int32 pinfo_index; - const value_info *vinfo; - int32 vinfo_index, vinfo_count; char *tempstr; if (size<=0L){ @@ -1256,7 +1250,7 @@ format_data(int32 type, char *ptr, long size) case B_COLOR_8_BIT_TYPE: str = new char[size*6+4]; *str = 0; - for (i=0; i "); break; } } + + // pad the rest with spaces + if (strlen(start)<60){ + strcat(str, " "+strlen(start) ); + } else { + strcat(str, " " ); + } + for (int32 i = 0; i < 10 && pinfo[pinfo_index].types[i] != 0; i++) { + uint32 type = pinfo[pinfo_index].types[i]; + char str2[4]; + sprintf(str2, "%c%c%c%c ", int(type & 0xFF000000) >> 24, + int(type & 0xFF0000) >> 16, int(type & 0xFF00) >> 8, (int)type & 0xFF); + strcat(str, str2); + } + + for (int32 i = 0; i < 3; i++) { + for (int32 j = 0; j < 5 && pinfo[pinfo_index].ctypes[i].pairs[j].type != 0; j++) { + uint32 type = pinfo[pinfo_index].ctypes[i].pairs[j].type; + char str2[4]; + sprintf(str2, "(%s %c%c%c%c)", pinfo[pinfo_index].ctypes[i].pairs[j].name, + int(type & 0xFF000000) >> 24, + int(type & 0xFF0000) >> 16, + int(type & 0xFF00) >> 8, (int)type & 0xFF); + strcat(str, str2); + } + } strcat(str, "\n"); // is there usage info? @@ -1328,15 +1346,12 @@ format_data(int32 type, char *ptr, long size) strcat(str, "\n"); } - - pinfo_index++; // take next propertyinfo } // handle value infos.... - vinfo = propinfo.Values(); - vinfo_index = 0; - vinfo_count = propinfo.CountValues(); + const value_info *vinfo = propinfo.Values(); + int32 vinfo_count = propinfo.CountValues(); #if TEST_VALUEINFO>0 value_info vinfo[10] = { {"Backup", 'back', B_COMMAND_KIND, "This command backs up your hard drive."}, {"Abort", 'abor', B_COMMAND_KIND, "Stops the current operation..."}, @@ -1348,7 +1363,7 @@ format_data(int32 type, char *ptr, long size) if (vinfo && vinfo_count>0){ sprintf(str+strlen(str), "\n name value kind\n--------------------------------------------------------------------------------\n"); - while (vinfo_index>24)&255; - uint8 digit1=(ID>>16)&255; - uint8 digit2=(ID>>8)&255; - uint8 digit3=(ID)&255; - bool itsvalid=false; + uint8 digit0 = (ID>>24)& 255; + uint8 digit1 = (ID>>16)& 255; + uint8 digit2 = (ID>>8) & 255; + uint8 digit3 = (ID) & 255; + bool itsvalid = false; if (digit0==0){ if (digit1==0){