/* include not needed for Aztec C using provided makefile */
#include "sb:sb.h"
extern int level;
extern void PrPlanes(), PrRastPort2();


void PrBitMap(string, bitmap) char *string; struct BitMap *bitmap;
{
static struct StructData structdata[] = {
     { "-BytesPerRow", "UWORD",   12, INTSIZE    },
     { "-Rows",        "UWORD",   12, INTSIZE    },
     { "-Flags",       "UBYTE",   13, BYTESIZE   },
     { "-Depth",       "UBYTE",   13, BYTESIZE   },
     { "-Pad",         "UWORD",   12, INTSIZE    },
     { " Planes[8]",   "PLANEPTR", 5, PTRSIZE * 8}
  };
int sum, choice = -1;
  level++;
  while (choice) {
    sum = SetOptionText(string, structdata,
                         (APTR)bitmap, DATASIZE, 0);
    if ((choice = GetChoice(DATASIZE)) == 6)
      PrPlanes("BitPlanes belong to the BitMap", bitmap->Planes,
               bitmap->Rows, bitmap->BytesPerRow);
  }
  level--;
}


void PrPlanes(string, planes, rows, bytes)
char *string; PLANEPTR planes[]; UWORD rows, bytes;
{
static struct StructData structdata[] = {
     {" BitPlabe[0]",   "PLANEPTR", 5, PTRSIZE },
     {" BitPlabe[1]",   "PLANEPTR", 5, PTRSIZE },
     {" BitPlabe[2]",   "PLANEPTR", 5, PTRSIZE },
     {" BitPlabe[3]",   "PLANEPTR", 5, PTRSIZE },
     {" BitPlabe[4]",   "PLANEPTR", 5, PTRSIZE },
     {" BitPlabe[5]",   "PLANEPTR", 5, PTRSIZE },
     {" BitPlabe[6]",   "PLANEPTR", 5, PTRSIZE },
     {" BitPlabe[7]",   "PLANEPTR", 5, PTRSIZE }
  };
int sum, choice = -1;
  level++;
  while (choice) {
    sum = SetOptionText(string, structdata,
                        (APTR)planes, DATASIZE, 0);
    choice = GetChoice(8);
    if (choice >= 1 && choice <= 8 && planes[choice - 1])
      HexDump(structdata[choice - 1].membername,
              planes[choice - 1], PTRSIZE, (long)(rows * bytes));
  }
  level--;
}


void PrRastPort(string, rastport) char *string; struct RastPort *rastport;
{
static struct StructData structdata[] = {
     { "(Layer",      "struct Layer *)",     5, PTRSIZE  },
     { " BitMap",     "struct BitMap *",     5, PTRSIZE  },
     { "-Area Ptrn",  "USHORT *",            5, PTRSIZE  },
     { "(TmpRas",     "struct TmpRas *)",    5, PTRSIZE  },
     { "(AreaInfo",   "struct AreaInfo *)",  5, PTRSIZE  },
     { "(GelsInfo",   "struct GelsInfo *)",  5, PTRSIZE  },
     { "-Mask",       "UBYTE",              13, BYTESIZE },
     { "-FgPen",      "BYTE",                3, BYTESIZE },
     { "-BgPen",      "BYTE",                3, BYTESIZE },
     { "-AOlPen",     "BYTE",                3, BYTESIZE },
     { "-DrawMode",   "BYTE",                3, BYTESIZE },
     { "-AreaPtSize", "BYTE",                3, BYTESIZE },
     { "-linpatcnt",  "BYTE",                3, BYTESIZE },
     { "-dummy",      "BYTE",                3, BYTESIZE },
     { "(Flags",      "USHORT",             12, INTSIZE  },
     { "-LinePtrn",   "USHORT",             12, INTSIZE  }
  };
int sum, choice = -1;
  level++;
  while (choice) {
    sum = SetOptionText(string, structdata,
                        (APTR)rastport, DATASIZE, 0);
    switch (choice = GetChoice(MAXGADG + 1)) {
      case 2:
        if (rastport->BitMap)
          PrBitMap("The BitMap for the RastPort", rastport->BitMap);
        break;
      case MOREGADG:
        PrRastPort2("More RastPort members", rastport, sum);
        break;
    }
  }
  level--;
}


void PrRastPort2(string, rastport, offset)
char *string; struct RastPort *rastport; int offset;
{
static struct StructData structdata[] = {
     {"-cp_x",            "SHORT",             2, INTSIZE     },
     {"-cp_y",            "SHORT",             2, INTSIZE     },
     {" minterms[8]",     "UBYTE",             0, BYTESIZE * 8},
     {"-PenWidth",        "SHORT",             2, INTSIZE     },
     {"-PenHeight",       "SHORT",             2, INTSIZE     },
     {"(TextFont",        "struct Font *)",    5, PTRSIZE     },
     {"-AlgoStyle",       "UBYTE",            13, BYTESIZE    },
     {"(TxFlags",         "UBYTE",            13, BYTESIZE    },
     {"-TxHeight",        "UWORD",            12, INTSIZE     },
     {"-TxWidth",         "UWORD",            12, INTSIZE     },
     {"-TxBaseLine",      "UWORD",            12, INTSIZE     },
     {"-TxSpacing",       "WORD",              2, INTSIZE     },
     {"-RP_User",         "WORD",              2, INTSIZE     },
     {" wordreserved[7]", "UWORD",             0, INTSIZE * 7 },
     {" longreserved[2]", "ULONG",             0, PTRSIZE * 2 },
     {" reserved[8]",     "UBYTE",             0, BYTESIZE * 8}
  };
int sum, choice = -1;
  level++;
  while (choice) {
    sum = SetOptionText(string, structdata,
                        (APTR)rastport, DATASIZE, offset);
    switch (choice = GetChoice(DATASIZE)) {
      case 3:
        HexDump("Hexdump of RastPort minterms bytes",
                &rastport->minterms[0], BYTESIZE, (long)BYTESIZE * 8);
        break;
      case 14:
        HexDump("Hexdump of reserved RastPort words",
                &rastport->wordreserved[0], INTSIZE, (long)INTSIZE * 7);
        break;
      case 15:
        HexDump("Hexdump of reserved RastPort longwords",
                &rastport->longreserved[0], PTRSIZE, (long)PTRSIZE * 2);
        break;
      case 16:
        HexDump("Hexdump of reserved RastPort bytes",
                &rastport->reserved[0], BYTESIZE, (long)BYTESIZE * 8);
        break;
    }
  }
  level--;
}
