home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / FMTDATA.C < prev    next >
Text File  |  1996-08-22  |  52KB  |  1,338 lines

  1. /*****************************************************************************/
  2. /* File:                                                                     */
  3. /*   fmtdata.c                                                            813*/
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*                                                                           */
  7. /*  Router/formatter for data items.                                         */
  8. /*                                                                           */
  9. /* History:                                                                  */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12.  
  13. #include "all.h"
  14.  
  15. /*****************************************************************************/
  16. /* FmtDataItem()                                                             */
  17. /*                                                                           */
  18. /* Description:                                                              */
  19. /*                                                                           */
  20. /*   This routine routes the typeno to the correct formatter.                */
  21. /*                                                                           */
  22. /* Parameters:                                                               */
  23. /*                                                                           */
  24. /*   cp         -> to the buffer we're formatting into.                      */
  25. /*   data       location in user's address space of data                     */
  26. /*              we want to format.                                           */
  27. /*   mid        module in which the typeno is defined.                       */
  28. /*   typeno     the type number of the record to be formatted.               */
  29. /*   sfx        stack frame index for stack/parameter variables.             */
  30. /*                                                                           */
  31. /* Return:                                                                   */
  32. /*                                                                           */
  33. /*   void                                                                    */
  34. /*                                                                           */
  35. /* Assumptions:                                                              */
  36. /*                                                                           */
  37. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  38. /*  typeno is a valid type number within the mid.                            */
  39. /*                                                                           */
  40. /*****************************************************************************/
  41. void FormatDataItem( UCHAR *cp, UINT data, UINT mid, USHORT typeno, UINT sfx )
  42. {
  43.  Trec  *tp;
  44.  
  45. startatthetop:
  46.  
  47.  if( typeno < 512 )
  48.  {
  49. recirculate:
  50.   switch( typeno )
  51.   {
  52.    case TYPE_VOID:
  53.     FmtBytes( cp, data , sfx , 16);
  54.     break;
  55.  
  56.    case TYPE_CHAR:
  57.    case TYPE_UCHAR:
  58.     FmtChar( cp, data , sfx , typeno);
  59.     break;
  60.  
  61.    case TYPE_SHORT:
  62.    case TYPE_USHORT:
  63.     FmtShort( cp, data , sfx , typeno);
  64.     break;
  65.  
  66.    case TYPE_LONG:
  67.    case TYPE_ULONG:
  68.     FmtLong( cp, data , sfx , typeno);
  69.     break;
  70.  
  71.  
  72.    case TYPE_FLOAT:
  73.    case TYPE_DOUBLE:
  74.    case TYPE_LDOUBLE:
  75.     FmtFloat( mid,cp, data , sfx , typeno);
  76.     break;
  77.  
  78.    case TYPE_PCHAR:
  79.    case TYPE_PSHORT:
  80.    case TYPE_PLONG:
  81.    case TYPE_PUCHAR:
  82.    case TYPE_PUSHORT:
  83.    case TYPE_PULONG:
  84.    case TYPE_PFLOAT:
  85.    case TYPE_PDOUBLE:
  86.    case TYPE_PLDOUBLE:
  87.    case TYPE_PVOID:
  88.    case TYPE_FPCHAR:
  89.    case TYPE_FPSHORT:
  90.    case TYPE_FPLONG:
  91.    case TYPE_FPUCHAR:
  92.    case TYPE_FPUSHORT:
  93.    case TYPE_FPULONG:
  94.    case TYPE_FPFLOAT:
  95.    case TYPE_FPDOUBLE:
  96.    case TYPE_FPLDOUBLE:
  97.    case TYPE_FPVOID:
  98.    case TYPE_N16PCHAR:
  99.    case TYPE_N16PSHORT:
  100.    case TYPE_N16PLONG:
  101.    case TYPE_N16PUCHAR:
  102.    case TYPE_N16PUSHORT:
  103.    case TYPE_N16PULONG:
  104.    case TYPE_N16PFLOAT:
  105.    case TYPE_N16PDOUBLE:
  106.    case TYPE_N16PLDOUBLE:
  107.    case TYPE_N16PVOID:
  108.     typeno = FmtPtr(&cp,(ULONG*)&data,0/*mid=0*/,typeno,sfx);
  109.     if( typeno )
  110.      goto recirculate;
  111.     break;
  112.  
  113.   }
  114.   /***************************************************************************/
  115.   /* Remove the \0 inserted by the formatter.                                */
  116.   /***************************************************************************/
  117.   *(strchr(cp,'\0')) = ' ';
  118.   return;
  119.  }
  120.  /****************************************************************************/
  121.  /* - Now, handle typenos > 512.                                             */
  122.  /* - QbasetypeRec may return with tp pointing to a TD_USERDEF record with   */
  123.  /*   a primitive type index. In this case, we grab the primitive typeno     */
  124.  /*   and recirculate.                                                       */
  125.  /****************************************************************************/
  126.  else
  127.  {
  128.   tp = QbasetypeRec(mid,typeno);
  129.   if( tp && (tp->RecType == T_TYPDEF) )
  130.   {
  131.    typeno = ((TD_USERDEF*)tp)->TypeIndex;
  132.    goto recirculate;
  133.   }
  134.  }
  135.  /****************************************************************************/
  136.  /* When we get here, we have a tp pointing to a base type record and it     */
  137.  /* is not a T_USERDEF record.                                               */
  138.  /****************************************************************************/
  139.  switch(tp->RecType)
  140.  {
  141.   default:
  142.    break;
  143.  
  144.   case T_MEMFNC:
  145.   {
  146. // FmtMemFncAttrs( tp, cp );
  147.   }
  148.   break;
  149.  
  150.   case T_BSECLS:
  151.   {
  152.    USHORT    typeno;
  153.    TD_CLASS *pClass;
  154.  
  155.    typeno  = ((TD_BSECLS*)tp)->TypeIndex;
  156.    pClass  = (TD_CLASS*)QtypeRec(mid, typeno);
  157.  
  158.    strncpy( cp, pClass->Name, pClass->NameLen );
  159.   }
  160.   break;
  161.  
  162.   case T_FRIEND:
  163.    break;
  164.  
  165.   case T_CLSDEF:
  166.   {
  167.    typeno  = ((TD_CLSDEF*)tp)->TypeIndex;
  168.    goto startatthetop;
  169.   }
  170. //break;
  171.  
  172.   case T_CLSMEM:
  173.   {
  174.    typeno = ((TD_CLSMEM*)tp)->TypeIndex;
  175.    goto startatthetop;
  176.   }
  177. //break;
  178.  
  179.   case T_SCALAR:
  180.   case T_PROC:
  181.   case T_ENTRY:
  182.   case T_FUNCTION:
  183.   case T_ARRAY:
  184.   case T_STRUCT:
  185.    FmtBytes( cp, data , sfx , 16);
  186.    *(strchr(cp,'\0')) = ' ';
  187.    break;
  188.  
  189.   case T_CLASS:
  190.    strcpy(cp, "...object");
  191.    *(strchr(cp,'\0')) = ' ';
  192.    break;
  193.  
  194.   case T_ENUM:
  195.    typeno = FmtEnums( tp,&cp, data, mid, typeno, sfx);
  196.    /**************************************************************************/
  197.    /* typeno will be returned as 0 in the event of an error.                 */
  198.    /**************************************************************************/
  199.    if( typeno == 0 )
  200.     break;
  201.    *cp++ = ' ';
  202.    *cp++ = '=';
  203.    *cp++ = ' ';
  204.    goto recirculate;
  205.  
  206.   case T_BITFLD:
  207.    FmtBitField( tp, cp, data, sfx);
  208.    break;
  209.  
  210.   case T_REF:
  211.    FmtRef( cp, data , sfx );
  212.    break;
  213.  
  214. casepointer:
  215.   case T_PTR:
  216.   {
  217.    /**************************************************************************/
  218.    /* See the documentation for Pointer handling. It will make the           */
  219.    /* understanding of this much simpler.                                    */
  220.    /**************************************************************************/
  221.    (void)FmtPtr( &cp, (ULONG*)&data , mid , typeno , sfx);
  222.    typeno = ((TD_POINTER*)tp)->TypeIndex;
  223.  
  224.    if( typeno < 512 )
  225.     goto recirculate;
  226.  
  227.    tp = QbasetypeRec(mid,typeno);
  228.    switch( tp->RecType )
  229.    {
  230.     case T_TYPDEF:
  231.       typeno = ((TD_USERDEF*)tp)->TypeIndex;
  232.       goto recirculate;
  233.  
  234.     case T_PTR:
  235.      (void)FmtPtr( &cp, (ULONG*)&data , mid , typeno , sfx);
  236.      typeno = ((TD_POINTER*)tp)->TypeIndex;
  237.      if( (typeno < 512 ) )
  238.      {
  239.       if( !( typeno & MD_BITS) )
  240.        goto recirculate;
  241.       else
  242.       {
  243.        FmtBytes( cp, data , sfx , 16);
  244.        break;
  245.       }
  246.      }
  247.      tp = QbasetypeRec(mid,typeno);
  248.      switch( tp->RecType )
  249.      {
  250.       case T_TYPDEF:
  251.        typeno = ((TD_USERDEF*)tp)->TypeIndex;
  252.        if( (typeno < 512 ) && !( typeno & MD_BITS) )
  253.         goto recirculate;
  254.        break;
  255.  
  256.       default:
  257.       FmtBytes( cp, data , sfx , 16);
  258.       break;
  259.      }
  260.      break;
  261.  
  262.     default:
  263.      FmtBytes( cp, data , sfx , 16);
  264.      break;
  265.    }
  266.    *(strchr(cp,'\0')) = ' ';
  267.   }
  268.   break;   /* end case T_PTR */
  269.  }
  270. }
  271. /*****************************************************************************/
  272. /* FmtChar()                                                              813*/
  273. /*                                                                           */
  274. /* Description:                                                              */
  275. /*                                                                           */
  276. /*   Format signed/unsigned character data for display.                      */
  277. /*                                                                           */
  278. /* Parameters:                                                               */
  279. /*                                                                           */
  280. /*   cp         input - -> to the buffer we're formatting into.              */
  281. /*   UserAddr   input - location in user's address space of data             */
  282. /*                      we want to format.                                   */
  283. /*   sfx        input - stack frame index for auto data.                     */
  284. /*   typeno     input - primitive type no. Tells signed/unsigned.            */
  285. /*                                                                           */
  286. /* Return:                                                                   */
  287. /*                                                                           */
  288. /*   void                                                                    */
  289. /*                                                                           */
  290. /* Assumptions:                                                              */
  291. /*                                                                           */
  292. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  293. /*                                                                           */
  294. /*****************************************************************************/
  295. #define SIGNED   0x00
  296. #define UNSIGNED 0x04
  297. void FmtChar( char *cp, ULONG UserAddr, UINT sfx , USHORT typeno )
  298. {
  299.  UINT   read;
  300.  UINT   size;
  301.  signed char *dp;
  302.  char   fs[10] = "%-12d";
  303.  char   f2[4] = "%#x";
  304.  char   f3[5] = "\'%c\'";
  305.  
  306.  size = sizeof(char);
  307.  dp = (signed char *)GetAppData( UserAddr, size, &read, sfx);
  308.  if( !dp || (size != read) )
  309.   {sprintf(cp,"Invalid Address");return;}
  310.  
  311.  (*dp < 32 )? strcat(fs,f2):strcat(fs,f3);
  312.  if( typeno == TYPE_CHAR )
  313.   sprintf(cp,fs,*dp,(UCHAR)*dp);
  314.  else
  315.   sprintf(cp,fs,(UCHAR)*dp,(UCHAR)*dp);
  316.  
  317. }
  318. /*****************************************************************************/
  319. /* FmtShort()                                                             813*/
  320. /*                                                                           */
  321. /* Description:                                                              */
  322. /*                                                                           */
  323. /*   Format signed/unsigned primitive short data types.                      */
  324. /*                                                                           */
  325. /* Parameters:                                                               */
  326. /*                                                                           */
  327. /*   cp         input - -> to the buffer we're formatting into.              */
  328. /*   UserAddr   input - location in user's address space of data             */
  329. /*                      we want to format.                                   */
  330. /*   sfx        input - stack frame index for auto data.                     */
  331. /*   typeno     input - primitive type no. Tells signed/unsigned.            */
  332. /*                                                                           */
  333. /* Return:                                                                   */
  334. /*                                                                           */
  335. /*   void                                                                    */
  336. /*                                                                           */
  337. /* Assumptions:                                                              */
  338. /*                                                                           */
  339. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  340. /*                                                                           */
  341. /*****************************************************************************/
  342. void FmtShort( char *cp, ULONG UserAddr, UINT sfx , USHORT typeno )
  343. {
  344.  UINT   read;
  345.  UINT   size;
  346.  signed short *dp;
  347.  char   fs[10] = "%-12d%#hx";
  348.  
  349.  size = sizeof(short);
  350.  dp = (signed short *)GetAppData( UserAddr, size, &read, sfx);
  351.  if( !dp || (size != read) )
  352.   {sprintf(cp,"Invalid Address");return;}
  353.  
  354.  if( (typeno & TYP_BITS) == SIGNED )
  355.   sprintf(cp,fs,*dp,(USHORT)*dp);
  356.  else
  357.   sprintf(cp,fs,(USHORT)*dp,(USHORT)*dp);
  358. }
  359. /*****************************************************************************/
  360. /* FmtLong()                                                              813*/
  361. /*                                                                           */
  362. /* Description:                                                              */
  363. /*                                                                           */
  364. /*   Format signed/unsigned primitive long data types.                       */
  365. /*                                                                           */
  366. /* Parameters:                                                               */
  367. /*                                                                           */
  368. /*   cp         input - -> to the buffer we're formatting into.              */
  369. /*   UserAddr   input - location in user's address space of data             */
  370. /*                      we want to format.                                   */
  371. /*   sfx        input - stack frame index for auto data.                     */
  372. /*   typeno     input - primitive type no. Tells signed/unsigned.            */
  373. /*                                                                           */
  374. /* Return:                                                                   */
  375. /*                                                                           */
  376. /*   void                                                                    */
  377. /*                                                                           */
  378. /* Assumptions:                                                              */
  379. /*                                                                           */
  380. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  381. /*                                                                           */
  382. /*****************************************************************************/
  383. void FmtLong( char *cp, ULONG UserAddr, UINT sfx , USHORT typeno )
  384. {
  385.  UINT   read;
  386.  UINT   size;
  387.  signed long *dp;
  388.  char   fs[11];
  389.  
  390.  size = sizeof(long);
  391.  dp = (signed long *)GetAppData( UserAddr, size, &read, sfx);
  392.  if( !dp || (size != read) )
  393.   {sprintf(cp,"Invalid Address");return;}
  394.  
  395.  if( (typeno & TYP_BITS) == SIGNED )
  396.  {
  397.   strcpy(fs,"%-12ld%#lx");
  398.   sprintf(cp,fs,*dp,(ULONG)*dp);
  399.  }
  400.  else
  401.  {
  402.   strcpy(fs,"%-12lu%#lx");
  403.   sprintf(cp,fs,(ULONG)*dp,(ULONG)*dp);
  404.  }
  405. }
  406.  
  407. /*****************************************************************************/
  408. /* FmtFloat()                                                             813*/
  409. /*                                                                           */
  410. /* Description:                                                              */
  411. /*                                                                           */
  412. /*   Format primitive floating point types.                                  */
  413. /*                                                                           */
  414. /* Parameters:                                                               */
  415. /*                                                                           */
  416. /*   cp         input - -> to the buffer we're formatting into.              */
  417. /*   UserAddr   input - location in user's address space of data             */
  418. /*                      we want to format.                                   */
  419. /*   sfx        input - stack frame index for auto data.                     */
  420. /*   typeno     input - primitive type no. Tells signed/unsigned.            */
  421. /*                                                                           */
  422. /* Return:                                                                   */
  423. /*                                                                           */
  424. /*   void                                                                    */
  425. /*                                                                           */
  426. /* Assumptions:                                                              */
  427. /*                                                                           */
  428. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  429. /*                                                                           */
  430. /*****************************************************************************/
  431. void FmtFloat( UINT mid,char *cp, ULONG UserAddr, UINT sfx , USHORT typeno )
  432. {
  433.  UINT   read;
  434.  UINT   size;
  435.  signed long *dp;
  436.  
  437.  size = QtypeSize(mid,typeno);
  438.  dp = (signed long *)GetAppData( UserAddr, size, &read, sfx);
  439.  if( !dp || (size != read) )
  440.   {sprintf(cp,"Invalid Address");return;}
  441.  
  442.  /****************************************************************************/
  443.  /* Mask all the floating point exceptions while we execute the sprintf.     */
  444.  /* The debugger may trap if we don't do this.                               */
  445.  /*                                                                          */
  446.  /****************************************************************************/
  447.  _control87(0x37f,0xffff);
  448.  switch(typeno)
  449.  {
  450.   case TYPE_FLOAT:
  451.    sprintf(cp,"%.10g",*(float*)dp);
  452.    break;
  453.  
  454.   case TYPE_DOUBLE:
  455.    sprintf(cp,"%.18g",*(double*)dp);
  456.    break;
  457.  
  458.   case TYPE_LDOUBLE:
  459.    sprintf(cp,"%.21Lg",*(long double*)dp);
  460.    break;
  461.  }
  462.  /****************************************************************************/
  463.  /* - Clear any exceptions that may have occurred.                           */
  464.  /* - Reset the control word to the default value.                           */
  465.  /****************************************************************************/
  466.  _clear87();
  467.  _control87(CW_DEFAULT,0xffff);
  468. }
  469.  
  470. /*****************************************************************************/
  471. /* FmtPtr()                                                               813*/
  472. /*                                                                           */
  473. /* Description:                                                              */
  474. /*                                                                           */
  475. /*   Format pointers to signed/unsigned primitives.                          */
  476. /*                                                                           */
  477. /* Parameters:                                                               */
  478. /*                                                                           */
  479. /*   pcp        input - -> to -> to the buffer we're formatting into.        */
  480. /*   pUserAddr  input - -> to our variable containing the location in        */
  481. /*                         in user's address space of the pointer we         */
  482. /*                         we want to format.                                */
  483. /*   mid        input - module in which the typeno is defined.               */
  484. /*   typeno     input - the type number of the T_BITFLD recoard.             */
  485. /*   sfx        input - stack frame index for auto data.                     */
  486. /*                                                                           */
  487. /* Return:                                                                   */
  488. /*                                                                           */
  489. /*   void                                                                    */
  490. /*                                                                           */
  491. /* Assumptions:                                                              */
  492. /*                                                                           */
  493. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  494. /*                                                                           */
  495. /*****************************************************************************/
  496. static char fs1[]={'%','0','8','X',' ',0xCD,0x10,' ','\0'};
  497. static char fs2[]={'%','0','4','X',':','%','0','4','X',' ',0xCD,0x10,' ','\0'};
  498. static char fs3[]={'%','0','4','X',' ',0xCD,0x10,' ','\0'};
  499. USHORT FmtPtr(char **pcp,ULONG *pUserAddr,UINT mid, USHORT typeno,UINT sfx)
  500. {
  501.  UINT    read;
  502.  UINT    size;
  503.  signed  char  **dp;
  504.  ULONG   UserAddr = *pUserAddr;
  505.  char   *cp = *pcp;
  506.  UINT    type;
  507.  
  508.  type = GetPtrType(mid,typeno);
  509.  size = QtypeSize(mid,typeno);
  510.  
  511.  switch( type )
  512.  {
  513.   case PTR_0_32:
  514.   case PTR_16_16:
  515.    dp = ( signed char**)GetAppData( UserAddr, size, &read, sfx);
  516.    if( !dp || (size != read) )
  517.     {sprintf(cp,"Invalid Address");return(0);}
  518.  
  519.    if( type == PTR_0_32 )
  520.    {
  521.     sprintf(cp,fs1,*dp);
  522.     *pUserAddr = (ULONG)*dp;
  523.    }
  524.    else /* case PTR_16_16 */
  525.    {
  526.     sprintf(cp,fs2, *((USHORT*)dp+1),*(USHORT*)dp);
  527.     *pUserAddr = Data_SelOff2Flat( *((USHORT*)dp+1) , *(USHORT*)dp );
  528.    }
  529.    break;
  530.  
  531.   case PTR_0_16:
  532.    /**************************************************************************/
  533.    /* - Convert a BP Relative location of the near pointer to a flat address */
  534.    /*   if the 0:16 pointer is a stack variable.                             */
  535.    /* - Get 2 bytes of offset from the location.                             */
  536.    /* - Format the 0:16 pointer.                                             */
  537.    /* - Get the selector where the pointer was defined. Since the pointer is */
  538.    /*   near, the target of the pointer has to have the same selector.       */
  539.    /* - Form the flat address value of the pointer.                          */
  540.    /*                                                                        */
  541.    /**************************************************************************/
  542.    if( TestBit(UserAddr,STACKADDRBIT) )
  543.     UserAddr = StackBPRelToAddr( UserAddr , sfx );
  544.    if ( UserAddr == 0 )
  545.     {sprintf(cp,"Invalid Address");return(0);}
  546.  
  547.    dp = ( signed char**)GetAppData( UserAddr, size, &read, sfx);
  548.    if( !dp || (size != read) )
  549.     {sprintf(cp,"Invalid Address");return(0);}
  550.    sprintf(cp,fs3, *(USHORT*)dp);
  551.  
  552.    {
  553.     USHORT Sel;
  554.     USHORT Off;
  555.  
  556.     Data_Flat2SelOff(UserAddr, &Sel,&Off);
  557.     *pUserAddr = Data_SelOff2Flat( Sel, *(USHORT*)dp);
  558.    }
  559.  }
  560.  
  561.  /****************************************************************************/
  562.  /* - If the typeno is primitive, then zero the model bits and return        */
  563.  /*   the type of the pointer to the caller.                                 */
  564.  /* - If the typeno is complex, then echo the typeno back to the caller.     */
  565.  /*   What we return is irrelevant;however, we need to return something.     */
  566.  /****************************************************************************/
  567.  if( typeno < 512 )
  568.    typeno &= (~MD_BITS);
  569.  
  570.  /****************************************************************************/
  571.  /* Append strings to type char and type uchar pointers.                     */
  572.  /****************************************************************************/
  573.  if( typeno == TYPE_CHAR || typeno == TYPE_UCHAR )
  574.  {
  575.   char *cpend;
  576.   extern UINT VideoCols;
  577.  
  578.   cpend = (*pcp-STGCOL-1) + VideoCols - 1;
  579.   FmtString(cp+strlen(cp),cpend,*pUserAddr,sfx);
  580.   typeno = 0;
  581.  }
  582.  else
  583.   /***************************************************************************/
  584.   /* Kill the \0 at the end of the string by converting to a space.          */
  585.   /***************************************************************************/
  586.   *(*pcp=strchr(cp,'\0')) = ' ';
  587.  
  588.  return(typeno);
  589. }
  590.  
  591. /*****************************************************************************/
  592. /* FmtBytes()                                                             813*/
  593. /*                                                                           */
  594. /* Description:                                                              */
  595. /*                                                                           */
  596. /*   Format bytes in hex.                                                    */
  597. /*                                                                           */
  598. /* Parameters:                                                               */
  599. /*                                                                           */
  600. /*   cp         input - -> to the buffer we're formatting into.              */
  601. /*   UserAddr   input - location in user's address space of data             */
  602. /*                      we want to format.                                   */
  603. /*   sfx        input - stack frame index for auto data.                     */
  604. /*   size       input - number of byte to format.                            */
  605. /*                                                                           */
  606. /* Return:                                                                   */
  607. /*                                                                           */
  608. /*   void                                                                    */
  609. /*                                                                           */
  610. /* Assumptions:                                                              */
  611. /*                                                                           */
  612. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  613. /*                                                                           */
  614. /*****************************************************************************/
  615. void FmtBytes( char *cp, ULONG UserAddr, UINT sfx , UINT size )
  616. {
  617.  UINT   read;
  618.  int    i;
  619.  UCHAR *dp;
  620.  
  621.  dp = ( UCHAR *)GetAppData( UserAddr, size, &read, sfx);
  622.  if( !dp || (size != read) )
  623.  {
  624.   sprintf(cp,"Invalid Address");
  625.  }
  626.  else
  627.  {
  628.   *cp = '\0';
  629.   for( i=0; i < read; i++,dp++)
  630.   {
  631.    char buffer[4];
  632.  
  633.    sprintf(buffer, "%02X ", *dp);
  634.    strcat( cp, buffer );
  635.   }
  636.  }
  637. }
  638.  
  639. /*****************************************************************************/
  640. /* FmtString()                                                            813*/
  641. /*                                                                           */
  642. /* Description:                                                              */
  643. /*                                                                           */
  644. /*   Format a string.                                                        */
  645. /*                                                                           */
  646. /* Parameters:                                                               */
  647. /*                                                                           */
  648. /*   cp         input - -> to the buffer we're formatting into.              */
  649. /*   cpend      input - -> to the end of the buffer.                         */
  650. /*   UserAddr   input - location in user's address space of data             */
  651. /*                      we want to format.                                   */
  652. /*                                                                           */
  653. /* Return:                                                                   */
  654. /*                                                                           */
  655. /*   void                                                                    */
  656. /*                                                                           */
  657. /* Assumptions:                                                              */
  658. /*                                                                           */
  659. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  660. /*                                                                           */
  661. /*****************************************************************************/
  662. void FmtString( char *cp, char *cpend ,ULONG UserAddr, UINT sfx )
  663. {
  664.  UINT   read = 0;
  665.  UINT   size;
  666.  UCHAR *dp;
  667.  int    c;
  668.  
  669.  /****************************************************************************/
  670.  /*                                                                          */
  671.  /*         read                                                             */
  672.  /*      |<------------------>|                                              */
  673.  /*      |                    |                                              */
  674.  /*         size                                                             */
  675.  /*      |<------------------------------------------------->|               */
  676.  /*      |                                                   |               */
  677.  /*       ---------------------------------------------------                */
  678.  /*      |                                                   |               */
  679.  /*       ---------------------------------------------------                */
  680.  /*       |                   |                             |                */
  681.  /*       |                   |                             |                */
  682.  /*      cp                   cpend( if size<read)          cpend            */
  683.  /*                                                                          */
  684.  /****************************************************************************/
  685.  
  686.  size = cpend-cp;
  687.  dp = ( UCHAR *)GetAppData( UserAddr, size, &read, sfx);
  688.  if( !dp || read==0 )
  689.   {sprintf(cp,"Invalid Address");return;}
  690.  
  691.  if( read < size )
  692.   cpend = cp + read;
  693.  
  694.  *cp = '\"';
  695.  for( cp++; cp<=cpend && *dp != '\0'; cp++,dp++)
  696.  {
  697.   c = *dp;
  698.   /***************************************************************************/
  699.   /* show graphic characters as little dots.                                 */
  700.   /***************************************************************************/
  701.   if( c < 0x20 || c > 0x7F )
  702.    *cp = 0xFA;
  703.   else
  704.    *cp = c;
  705.  }
  706.  if( cp <= cpend )
  707.   *cp = '\"';
  708.  
  709.  /****************************************************************************/
  710.  /* null terminate the string just formatted.                                */
  711.  /****************************************************************************/
  712.  cp++; if( cp <= cpend ) *cp = '\0';
  713. }
  714.  
  715. /*****************************************************************************/
  716. /* FmtEnums()                                                             813*/
  717. /*                                                                           */
  718. /* Description:                                                              */
  719. /*                                                                           */
  720. /*   Format Enums.                                                           */
  721. /*                                                                           */
  722. /* Parameters:                                                               */
  723. /*                                                                           */
  724. /*   tp         input - -> to the enum type record.                          */
  725. /*   pcp        input - ->-> to the buffer we're formatting into.            */
  726. /*   UserAddr   input - location in user's address space of data             */
  727. /*                      we want to format.                                   */
  728. /*   mid        input - module in which the typeno is defined.               */
  729. /*   typeno     input - the type number of the T_BITFLD recoard.             */
  730. /*   sfx        input - stack frame index for auto data.                     */
  731. /*                                                                           */
  732. /* Return:                                                                   */
  733. /*                                                                           */
  734. /*   typeno     the primitive data type for the enum.                        */
  735. /*                                                                           */
  736. /* Assumptions:                                                              */
  737. /*                                                                           */
  738. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  739. /*  tp -> to a valid enum record.                                            */
  740. /*                                                                           */
  741. /*****************************************************************************/
  742. USHORT FmtEnums( Trec *tp,char **pcp,ULONG UserAddr,UINT mid,
  743.                  USHORT typeno,UINT sfx)
  744. {
  745.  char   *ename;
  746.  UINT    size;
  747.  USHORT  type;
  748.  long    lvalue;
  749.  long   *dp;
  750.  UINT    read;
  751.  ULONG   index;
  752.  
  753.  /****************************************************************************/
  754.  /* - Get the type of the enum.                                              */
  755.  /* - Get the size of the enum.                                              */
  756.  /* - Get the value of the enum.                                             */
  757.  /****************************************************************************/
  758.  type = ((TD_ENUM*)tp)->DataType;
  759.  size = QtypeSize(mid,type);
  760.  
  761.  dp = (signed long *)GetAppData( UserAddr, size, &read, sfx);
  762.  if( !dp || (size != read) )
  763.  {
  764.   sprintf(*pcp,"Invalid Address");
  765.   *(strchr(*pcp,'\0')) = ' ';
  766.   return(0);
  767.  }
  768.  
  769.  if( size == 1 )
  770.      lvalue = (long)(*(UCHAR *)dp);
  771.  else if( size == 2)
  772.      lvalue = (long)(*(USHORT *)dp);
  773.  else if( size == 4)
  774.      lvalue = *dp;
  775.  
  776.  /***************************************************************************/
  777.  /* - Get the name list index.                                              */
  778.  /* - Find the name associated with the enum value(lvalue) and format it.   */
  779.  /***************************************************************************/
  780.  typeno = ((TD_ENUM*)tp)->NameListIndex;
  781.  
  782.  tp = QbasetypeRec(mid, typeno);
  783.  if( tp && QNameList(tp,VERIFYVALUE,lvalue) )
  784.  {
  785.   index =  QNameList(tp,VALUEINDEX,lvalue);
  786.   ename =  (char*)QNameList(tp,NAME,index);
  787.   memcpy(*pcp, ename+sizeof(USHORT/*2 byte name length*/), *ename );
  788.  
  789.   /***************************************************************************/
  790.   /* bump the buffer pointer for the caller.                                 */
  791.   /***************************************************************************/
  792.   *pcp = *pcp + *ename;
  793.  }
  794.  return(type);
  795. }
  796.  
  797. /*****************************************************************************/
  798. /* FmtBitField()                                                          813*/
  799. /*                                                                           */
  800. /* Description:                                                              */
  801. /*                                                                           */
  802. /*   Format a Bitield.                                                       */
  803. /*                                                                           */
  804. /* Parameters:                                                               */
  805. /*                                                                           */
  806. /*   ptrec      input - -> to the enum type record.                          */
  807. /*   cp         input - -> to the buffer we're formatting into.              */
  808. /*   UserAddr   input - location in user's address space of data             */
  809. /*                      we want to format.                                   */
  810. /*   sfx        input - stack frame index for auto data.                     */
  811. /*                                                                           */
  812. /* Return:                                                                   */
  813. /*                                                                           */
  814. /*   void                                                                    */
  815. /*                                                                           */
  816. /* Assumptions:                                                              */
  817. /*                                                                           */
  818. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  819. /*  tp -> to a valid enum record.                                            */
  820. /*                                                                           */
  821. /*****************************************************************************/
  822. #define MAXPLXBITSTRINGLENGTH 64
  823. #define TYPE_ULONG_8          0
  824. void FmtBitField( Trec *ptrec, char *cp, ULONG UserAddr, UINT sfx)
  825. {
  826.  TD_BITFLD *tp;                        /* -> to base type record.            */
  827.  UCHAR      type;                      /* type of bitfld storage.            */
  828.  UCHAR      bitfldsize;                /* size of bitfld storage.            */
  829.  UCHAR      bitfldoffs;                /* offset of bitfld within stg.       */
  830.  UCHAR      size;                      /* size of bitfld storage.            */
  831.  UCHAR      offset;                    /* offset of bitfld within stg.       */
  832.  UCHAR      width;                     /* width  of bitfld within stg.       */
  833.  UINT       value;                     /* unsigned value for bitfld.         */
  834.  UCHAR      byteval;                   /* byte value of bit field.           */
  835.  UCHAR      bytemask;                  /* byte mask for bitfield.            */
  836.  int        i;
  837.  int        j;
  838.  UCHAR      fmtmask;                   /* storage mask for bitfld.           */
  839.  UCHAR     *dp;
  840.  UINT       read;
  841.  int        bitsconsumed;
  842.  
  843.  tp = (TD_BITFLD*)ptrec;
  844.  
  845.  bitfldsize = tp->BitSize;
  846.  bitfldoffs = tp->Offset;
  847.  type       = tp->BaseType;
  848.  if( type == TYPE_ULONG && (tp->Flags & DISPLAY_AS_VALUE ) )
  849.   type = TYPE_ULONG_8;
  850.  
  851.  size = bitfldsize;
  852.  offset = bitfldoffs;
  853.  switch( type )
  854.  {
  855.   case TYPE_UCHAR:
  856.   /*************************************************************************/
  857.   /* PL/X bit fields.                                                      */
  858.   /*************************************************************************/
  859.   {
  860.    width = 8;
  861.  
  862.    bitsconsumed = 0;
  863.    j = 0;
  864.    for(;;)
  865.    {
  866.     if(size+offset>width)
  867.     {
  868.      size = width - offset;
  869.     }
  870.  
  871.     for( i=0; i< (int)width ; i++ )
  872.      if( (i+j)<MAXPLXBITSTRINGLENGTH )
  873.       cp[j+i] = '.';
  874.     bytemask=(UCHAR)( (bytemask=0x7F)>>(size-1) );
  875.     bytemask=(UCHAR)((UCHAR)(~bytemask)>>offset );
  876.     dp = GetAppData(UserAddr,1,&read,sfx);
  877.     if( !dp || (read != 1 ) )
  878.      {sprintf(cp,"Invalid Address");return;}
  879.  
  880.     byteval = bytemask & (*dp);
  881.     fmtmask = 0x80;
  882.     for( i=0;
  883.          i< (int)width;
  884.          fmtmask >>=1, i++)
  885.     {
  886.      if( bytemask & fmtmask )
  887.      {
  888.       if( (i+j)<MAXPLXBITSTRINGLENGTH )
  889.        cp[j+i] = (UCHAR)((fmtmask & byteval)?'1':'0');
  890.      }
  891.     }
  892.     j += i;
  893.     bitsconsumed += (int)size;
  894.     if(bitsconsumed >= (int)bitfldsize)
  895.      break;
  896.     size = bitfldsize - (UCHAR)bitsconsumed;   /* ?????????????? */
  897.     offset = 0;
  898.     UserAddr++;
  899.    }
  900.   }
  901.   break;
  902.  
  903.   case TYPE_USHORT:
  904.   /**********************************************************************/
  905.   /* C211/C600 bitfields.                                               */
  906.   /**********************************************************************/
  907.   {
  908.    USHORT mask;
  909.    USHORT usfmtmask;
  910.  
  911.    width = 16;
  912.    for( i=0; i< (int)width ; i++ )
  913.     cp[i] = '.';
  914.    mask = (~(mask = 1))<<(size-1);
  915.    mask = (~mask)<<offset;
  916.  
  917.    dp = GetAppData(UserAddr,2,&read,sfx);
  918.    if( !dp || (read != 2 ) )
  919.     {sprintf(cp,"Invalid Address");return;}
  920.  
  921.    value = mask & (*(USHORT*)dp);
  922.    usfmtmask = 0x8000;
  923.    for( i=0; i< (int)width ; usfmtmask >>=1, i++ )
  924.    {
  925.     if( mask & usfmtmask )
  926.      cp[i] = (UCHAR)((usfmtmask & value)?'1':'0');
  927.    }
  928.   }
  929.   break;
  930.  
  931.   case TYPE_ULONG:
  932.   /**********************************************************************/
  933.   /* CL386 bitfields.                                                   */
  934.   /**********************************************************************/
  935.   {
  936.    ULONG mask;
  937.    ULONG ulfmtmask;
  938.  
  939.    width = 32;
  940.    for( i=0; i< (int)width ; i++ )
  941.     cp[i] = '.';
  942.    mask = (~(mask = 1))<<(size-1);
  943.    mask = (~mask)<<offset;
  944.  
  945.    dp = GetAppData(UserAddr,4,&read,sfx);
  946.    if( !dp || (read != 4 ) )
  947.     {sprintf(cp,"Invalid Address");return;}
  948.  
  949.    value = mask & (*(ULONG*)dp);
  950.    ulfmtmask = 0x80000000;
  951.    for( i=0; i< (int)width ; ulfmtmask >>=1, i++ )
  952.    {
  953.       if( mask & ulfmtmask )
  954.        cp[i] = (UCHAR)((ulfmtmask & value)?'1':'0');
  955.    }
  956.   }
  957.   break;
  958.  
  959.   case TYPE_ULONG_8:
  960.   /**********************************************************************/
  961.   /* IBM C SET-2 Bitfields.                                             */
  962.   /**********************************************************************/
  963.   {
  964.    if ( (size > 8) || ((offset+size) > 8) )
  965.    {
  966.     /********************************************************************/
  967.     /* If the bit field spans across bytes then we will not be able     */
  968.     /* show the exact memory lay out of bits since they are packed      */
  969.     /* and filled from lower order bits to higher order bits.           */
  970.     /* In this case we convert the bit string into Hex value and show   */
  971.     /* it as a bit string.                                              */
  972.     /********************************************************************/
  973.     UINT uifmtmask;
  974.     if (!BytesToValue(UserAddr,offset,size,sfx,&value))
  975.        return;
  976.     uifmtmask = 0x1;
  977.     for( i=0; i< (int)size; uifmtmask <<=1, i++)
  978.     {
  979.      if( value & uifmtmask )
  980.        cp[size-i-1] = (UCHAR)'1';
  981.      else
  982.        cp[size-i-1] = (UCHAR)'0';
  983.     }
  984.    }
  985.    else
  986.    {
  987.     /********************************************************************/
  988.     /* If the bit field doesn't span across a byte then show the        */
  989.     /* exact memory lay out of bits.                                    */
  990.     /********************************************************************/
  991.     width = 8;
  992.     for( i=0; i< (int)width ; i++ )
  993.       cp[i] = '.';
  994.     bytemask=(UCHAR)( (~(bytemask = 1))<<(size-1) );
  995.     bytemask=(UCHAR)((UCHAR)(~bytemask)<<offset );
  996.     dp = GetAppData(UserAddr,1,&read,sfx);
  997.     if( !dp || (read != 1 ) )
  998.      {sprintf(cp,"Invalid Address");return;}
  999.  
  1000.     byteval = bytemask & (*dp);
  1001.     fmtmask = 0x80;
  1002.     for( i=0; i< (int)width; fmtmask >>=1, i++)
  1003.     {
  1004.      if( bytemask & fmtmask )
  1005.        cp[i] = (UCHAR)((fmtmask & byteval)?'1':'0');
  1006.     }
  1007.    }
  1008.   }
  1009.   break;
  1010.  }                                     /* end of switch{}.                  */
  1011.  return;
  1012. }
  1013.  
  1014. /*****************************************************************************/
  1015. /* - format member function attributes.                                      */
  1016. /*****************************************************************************/
  1017. #define MEMFNC_PRIVATE      0x00
  1018. #define MEMFNC_PROTECTED    0x01
  1019. #define MEMFNC_PUBLIC       0x02
  1020.  
  1021. #define MEMFNC_CONSTRUCTOR  0x1
  1022. #define MEMFNC_DESTRUCTOR   0x2
  1023.  
  1024. #define SMEMFNC_PRIVATE     "Pri"
  1025. #define SMEMFNC_PROTECTED   "Pro"
  1026. #define SMEMFNC_PUBLIC      "Pub"
  1027.  
  1028. #define SMEMFNC_CONSTRUCTOR "Ct"
  1029. #define SMEMFNC_DESTRUCTOR  "Dt"
  1030.  
  1031. #define MEMFNC_STATIC      0x01
  1032. #define MEMFNC_INLINE      0x02
  1033. #define MEMFNC_CONST       0x04
  1034. #define MEMFNC_VOL         0x08
  1035. #define MEMFNC_VIRTUAL     0x10
  1036.  
  1037. #define SMEMFNC_STATIC     "St"
  1038. #define SMEMFNC_INLINE     "In"
  1039. #define SMEMFNC_CONST      "Co"
  1040. #define SMEMFNC_VOL        "Vo"
  1041. #define SMEMFNC_VIRTUAL    "Vir"
  1042.  
  1043. void FmtMemFncAttrs( Trec *pTrec, UCHAR *cp )
  1044. {
  1045.  TD_MEMFNC *pMemFnc;
  1046.  
  1047.  pMemFnc = (TD_MEMFNC*)pTrec;
  1048.  
  1049.  switch(pMemFnc->Protection)
  1050.  {
  1051.   case  MEMFNC_PRIVATE:
  1052.   {
  1053.    strcpy(cp, SMEMFNC_PRIVATE);
  1054.   }
  1055.   break;
  1056.  
  1057.   case  MEMFNC_PROTECTED:
  1058.   {
  1059.    strcpy(cp, SMEMFNC_PROTECTED);
  1060.   }
  1061.   break;
  1062.  
  1063.   case  MEMFNC_PUBLIC:
  1064.   {
  1065.    strcpy(cp, SMEMFNC_PUBLIC);
  1066.   }
  1067.   break;
  1068.  }
  1069.  cp += strlen(cp);
  1070.  
  1071.  switch(pMemFnc->FuncType)
  1072.  {
  1073.   case  MEMFNC_CONSTRUCTOR:
  1074.   {
  1075.    strcpy(cp, SMEMFNC_CONSTRUCTOR);
  1076.   }
  1077.   break;
  1078.  
  1079.   case  MEMFNC_DESTRUCTOR:
  1080.   {
  1081.    strcpy(cp, SMEMFNC_DESTRUCTOR);
  1082.   }
  1083.   break;
  1084.  }
  1085.  
  1086.  if(pMemFnc->TypeQual & MEMFNC_STATIC   )
  1087.  {
  1088.   cp += strlen(cp);
  1089.   strcpy(cp, SMEMFNC_STATIC);
  1090.  }
  1091.  
  1092.  if(pMemFnc->TypeQual & MEMFNC_INLINE   )
  1093.  {
  1094.   cp += strlen(cp);
  1095.   strcpy(cp, SMEMFNC_INLINE);
  1096.  }
  1097.  
  1098.  if(pMemFnc->TypeQual & MEMFNC_CONST    )
  1099.  {
  1100.   cp += strlen(cp);
  1101.   strcpy(cp, SMEMFNC_CONST);
  1102.  }
  1103.  
  1104.  if(pMemFnc->TypeQual & MEMFNC_VOL      )
  1105.  {
  1106.   cp += strlen(cp);
  1107.   strcpy(cp, SMEMFNC_VOL);
  1108.  }
  1109.  
  1110.  if(pMemFnc->TypeQual & MEMFNC_VIRTUAL  )
  1111.  {
  1112.   cp += strlen(cp);
  1113.   strcpy(cp, SMEMFNC_VIRTUAL);
  1114.  }
  1115. }
  1116.  
  1117. /*****************************************************************************/
  1118. /* - format class member attributes.                                         */
  1119. /*****************************************************************************/
  1120. void FmtClsMemAttrs( Trec *pTrec, UCHAR *cp )
  1121. {
  1122.  TD_CLSMEM *pClsMem;
  1123.  
  1124.  pClsMem = (TD_CLSMEM*)pTrec;
  1125.  
  1126.  switch(pClsMem->Protection)
  1127.  {
  1128.   case  CLSMEM_PRIVATE:
  1129.   {
  1130.    strcpy(cp, SCLSMEM_PRIVATE);
  1131.   }
  1132.   break;
  1133.  
  1134.   case  CLSMEM_PROTECTED:
  1135.   {
  1136.    strcpy(cp, SCLSMEM_PROTECTED);
  1137.   }
  1138.   break;
  1139.  
  1140.   case  CLSMEM_PUBLIC:
  1141.   {
  1142.    strcpy(cp, SCLSMEM_PUBLIC);
  1143.   }
  1144.   break;
  1145.  }
  1146.  cp += strlen(cp);
  1147.  
  1148.  if(pClsMem->TypeQual & CLSMEM_STATIC   )
  1149.  {
  1150.   cp += strlen(cp);
  1151.   strcpy(cp, SCLSMEM_STATIC);
  1152.  }
  1153.  
  1154.  if(pClsMem->TypeQual & CLSMEM_VTABLE   )
  1155.  {
  1156.   cp += strlen(cp);
  1157.   strcpy(cp, SCLSMEM_VTABLE);
  1158.  }
  1159.  
  1160.  if(pClsMem->TypeQual & CLSMEM_VBASE    )
  1161.  {
  1162.   cp += strlen(cp);
  1163.   strcpy(cp, SCLSMEM_VBASE);
  1164.  }
  1165.  
  1166.  if(pClsMem->TypeQual & CLSMEM_CONST    )
  1167.  {
  1168.   cp += strlen(cp);
  1169.   strcpy(cp, SCLSMEM_CONST);
  1170.  }
  1171.  
  1172.  if(pClsMem->TypeQual & CLSMEM_VOL  )
  1173.  {
  1174.   cp += strlen(cp);
  1175.   strcpy(cp, SCLSMEM_VOL);
  1176.  }
  1177.  
  1178.  if(pClsMem->TypeQual & CLSMEM_SELF )
  1179.  {
  1180.   cp += strlen(cp);
  1181.   strcpy(cp, SCLSMEM_SELF);
  1182.  }
  1183. }
  1184.  
  1185. /*****************************************************************************/
  1186. /* - format classdef attributes.                                             */
  1187. /*****************************************************************************/
  1188. #define CLSDEF_PRIVATE      0x00
  1189. #define CLSDEF_PROTECTED    0x01
  1190. #define CLSDEF_PUBLIC       0x02
  1191.  
  1192. #define SCLSDEF_PRIVATE     "Pri"
  1193. #define SCLSDEF_PROTECTED   "Pro"
  1194. #define SCLSDEF_PUBLIC      "Pub"
  1195.  
  1196. void FmtClsDefAttrs( Trec *pTrec, UCHAR *cp )
  1197. {
  1198.  TD_CLSDEF *pClsDef;
  1199.  
  1200.  pClsDef = (TD_CLSDEF*)pTrec;
  1201.  
  1202.  switch(pClsDef->Protection)
  1203.  {
  1204.   case  CLSDEF_PRIVATE:
  1205.   {
  1206.    strcpy(cp, SCLSDEF_PRIVATE);
  1207.   }
  1208.   break;
  1209.  
  1210.   case  CLSDEF_PROTECTED:
  1211.   {
  1212.    strcpy(cp, SCLSDEF_PROTECTED);
  1213.   }
  1214.   break;
  1215.  
  1216.   case  CLSDEF_PUBLIC:
  1217.   {
  1218.    strcpy(cp, SCLSDEF_PUBLIC);
  1219.   }
  1220.   break;
  1221.  }
  1222. }
  1223.  
  1224. /*****************************************************************************/
  1225. /* - format base class attributes.                                           */
  1226. /*****************************************************************************/
  1227. #define BSECLS_PRIVATE      0x00
  1228. #define BSECLS_PROTECTED    0x01
  1229. #define BSECLS_PUBLIC       0x02
  1230.  
  1231. #define SBSECLS_PRIVATE     "Private "
  1232. #define SBSECLS_PROTECTED   "Protected "
  1233. #define SBSECLS_PUBLIC      "Public "
  1234.  
  1235. #define BSECLS_VIRTUAL      0x01
  1236.  
  1237. #define SBSECLS_VIRTUAL     "Virtual "
  1238.  
  1239. void FmtBseClsAttrs( Trec *pTrec, UCHAR *cp )
  1240. {
  1241.  TD_BSECLS *pBseCls;
  1242.  
  1243.  pBseCls = (TD_BSECLS*)pTrec;
  1244.  
  1245.  *cp++= ' ';
  1246.  *cp++= ':';
  1247.  *cp++= ' ';
  1248.  
  1249.  switch(pBseCls->Protection)
  1250.  {
  1251.   case  BSECLS_PRIVATE:
  1252.   {
  1253.    strcpy(cp, SBSECLS_PRIVATE);
  1254.   }
  1255.   break;
  1256.  
  1257.   case  BSECLS_PROTECTED:
  1258.   {
  1259.    strcpy(cp, SBSECLS_PROTECTED);
  1260.   }
  1261.   break;
  1262.  
  1263.   case  BSECLS_PUBLIC:
  1264.   {
  1265.    strcpy(cp, SBSECLS_PUBLIC);
  1266.   }
  1267.   break;
  1268.  }
  1269.  cp += strlen(cp);
  1270.  
  1271.  if(pBseCls->TypeQual & BSECLS_VIRTUAL  )
  1272.  {
  1273.   cp += strlen(cp);
  1274.   strcpy(cp, SBSECLS_VIRTUAL);
  1275.  }
  1276. }
  1277.  
  1278. /*****************************************************************************/
  1279. /* - format friend function attributes.                                      */
  1280. /*****************************************************************************/
  1281. void FmtFriendAttrs( Trec *pTrec, UCHAR *cp )
  1282. {
  1283.  TD_FRIEND *pFriend;
  1284.  
  1285.  pFriend = (TD_FRIEND*)pTrec;
  1286.  
  1287.  if(pFriend->TypeQual & FRIEND_CLASS )
  1288.  {
  1289.   strcpy(cp, SFRIEND_CLASS);
  1290.  }
  1291.  else
  1292.  {
  1293.   strcpy(cp, SFRIEND_FUNCTION);
  1294.  }
  1295. }
  1296.  
  1297. /*****************************************************************************/
  1298. /* FmtRef()                                                               813*/
  1299. /*                                                                           */
  1300. /* Description:                                                              */
  1301. /*                                                                           */
  1302. /*   Format signed/unsigned primitive long data types.                       */
  1303. /*                                                                           */
  1304. /* Parameters:                                                               */
  1305. /*                                                                           */
  1306. /*   cp         -> to the buffer we're formatting into.                      */
  1307. /*   UserAddr   location in user's address space of data                     */
  1308. /*              we want to format.                                           */
  1309. /*   sfx        stack frame index for auto data.                             */
  1310. /*                                                                           */
  1311. /* Return:                                                                   */
  1312. /*                                                                           */
  1313. /*   void                                                                    */
  1314. /*                                                                           */
  1315. /* Assumptions:                                                              */
  1316. /*                                                                           */
  1317. /*  cp -> to a buffer that has been pre-formatted with blanks.               */
  1318. /*                                                                           */
  1319. /*****************************************************************************/
  1320. void FmtRef( char *cp, ULONG UserAddr, UINT sfx )
  1321. {
  1322.  UINT   read;
  1323.  UINT   size;
  1324.  signed long *dp;
  1325.  
  1326.  size = sizeof(long);
  1327.  dp = (signed long *)GetAppData( UserAddr, size, &read, sfx);
  1328.  if( !dp || (size != read) )
  1329.  {
  1330.   sprintf(cp,"Invalid Address");
  1331.  }
  1332.  else
  1333.  {
  1334.   sprintf(cp, "%#lx...Reference", (ULONG)*dp );
  1335.  }
  1336.  *(strchr(cp,'\0')) = ' ';
  1337. }
  1338.