home *** CD-ROM | disk | FTP | other *** search
/ YPA: Your Privacy Assured / YPA.ISO / other_goodies / utilities / amigaguid.lha / AmigaGuide / AG_V39 / Source / HyperBrowser / class.c < prev    next >
C/C++ Source or Header  |  1993-01-08  |  3KB  |  89 lines

  1. /* class.c
  2.  *
  3.  * (c) Copyright 1992 Commodore-Amiga, Inc.  All rights reserved.
  4.  *
  5.  * This software is provided as-is and is subject to change; no warranties
  6.  * are made.  All use is at your own risk.  No liability or responsibility
  7.  * is assumed.
  8.  *
  9.  */
  10.  
  11. #include "hyperbrowser.h"
  12.  
  13. /*****************************************************************************/
  14.  
  15. /* Find the list pointer given a node pointer */
  16. struct MinList *FindHead (struct MinNode * node)
  17. {
  18.     struct MinList *list;
  19.  
  20.     while (node)
  21.     {
  22.     if (!node->mln_Pred)
  23.         list = (struct MinList *) node;
  24.     node = node->mln_Pred;
  25.     }
  26.  
  27.     return (list);
  28. }
  29.  
  30. /*****************************************************************************/
  31.  
  32. void showclasslist (struct GlobalData * gd)
  33. {
  34.     struct ExecBase *SysBase = (*((struct ExecBase **) 4));
  35.     struct MinList *list;
  36.     struct MinNode *node;
  37.     struct _Object *o;
  38.     struct IClass *cl;
  39.     struct Image *im;
  40.     UBYTE notes[12];
  41.     ULONG min, max;
  42.     ULONG aEntry;
  43.     ULONG cEntry;
  44.  
  45.     /* Clear notes */
  46.     memset (notes, 0, sizeof (notes));
  47.  
  48.     /* Get the rom start and stop for this machine */
  49.     min = ((ULONG) (SysBase->LibNode.lib_IdString)) & 0xFFFF0000;
  50.     max = min + 0x80000;
  51.  
  52.     /* Get a handle on a boopsi object */
  53.     if (im = (struct Image *) NewObjectA (NULL, "frameiclass", NULL))
  54.     {
  55.     /* Convert the image to a boopsi object */
  56.     o = (struct _Object *) (((ULONG) im) - (sizeof (struct MinNode) + sizeof (ULONG)));
  57.  
  58.     /* Find the pointer to the boopsi class list */
  59.     list = FindHead (&(o->o_Class->cl_Dispatcher.h_MinNode));
  60.  
  61.     /* Build the title */
  62.     strcpy (gd->gd_Node, "@{b}Name                        Super                      P Objs Subs Address@{ub}\n");
  63.  
  64.     /* Step through the list */
  65.     for (node = list->mlh_Head; node->mln_Succ; node = node->mln_Succ)
  66.     {
  67.         cl = (struct IClass *) node;
  68.  
  69.         aEntry = (ULONG) cl->cl_Dispatcher.h_Entry;
  70.         cEntry = (ULONG) cl->cl_Dispatcher.h_SubEntry;
  71.  
  72.         sprintf (notes, "%08lx", cEntry);
  73.         if ((aEntry >= min) && (aEntry <= max))
  74.         strcpy (notes, "ROM");
  75.         else if ((cEntry >= min) && (cEntry <= max))
  76.         strcpy (notes, "ROM");
  77.         else
  78.         strcpy (notes, "Disk");
  79.  
  80.         bprintf (gd, "@{\"%-25s\" link HYPERNOZY.CLASS.(%08lx)} @{\"%-25s\" link HYPERNOZY.CLASS.(%08lx)} %ld %4ld %4ld @{\"%08lx\" link HYPERNOZY.MEMORY.(%08lx)}\n", cl->cl_ID, cl, ((cl->cl_Super) ? cl->cl_Super->cl_ID : ""), cl->cl_Super, cl->cl_Flags, cl->cl_ObjectCount, cl->cl_SubclassCount, cl, cl);
  81.     }
  82.  
  83.     /* Delete the object, now that we are done with it */
  84.     DisposeObject (im);
  85.     }
  86.     else
  87.     strcpy (gd->gd_Node, "@{b}couldn't create first object.@{ub}\n");
  88. }
  89.