|
static int printList(struct resbuf *pBuf)
{
int rt, i;
//char buf[133]; /* should only need 1 byte for <return>, but
// play it safe since ads_getstring can accept
// up to 132 characters */
for (i = 0;pBuf != NULL;i++, pBuf = pBuf->rbnext) {
if (pBuf->restype < 0)
rt = pBuf->restype; /* Entity name (or other sentinel) */
else if (pBuf->restype < 10)
rt = RTSTR;
else if (pBuf->restype < 38)
rt = RT3DPOINT;
else if (pBuf->restype < 60)
rt = RTREAL;
else if (pBuf->restype < 80)
rt = RTSHORT;
else if (pBuf->restype < 100)
rt = RTLONG;
else if (pBuf->restype == 100)
rt = RTSTR;
else if (pBuf->restype < 106)
rt = RTSTR;
else if (pBuf->restype < 148)
rt = RTREAL;
else if (pBuf->restype < 290)
rt = RTSHORT;
else if (pBuf->restype < 320)
rt = RTSTR;
else if (pBuf->restype < 370)
rt = RTENAME;
else if (pBuf->restype < 999)
rt = RT3DPOINT;
else if (pBuf->restype < 1010)
rt = RTSTR;
else if (pBuf->restype < 1040)
rt = RT3DPOINT;
else if (pBuf->restype < 1060)
rt = RTREAL;
else if (pBuf->restype < 1071)
rt = RTSHORT;
else if (pBuf->restype == 1071)
rt = RTLONG;
else /* pBuf->restype is already RTSHORT, RTSTR, */
rt = pBuf->restype; /* etc. or else it is unknown. */
switch (rt) {
case RTSHORT:
if (pBuf->restype == RTSHORT)
acutPrintf(_T("RTSHORT : %d\n"), pBuf->resval.rint);
else
acutPrintf(_T("(%d . %d)\n"), pBuf->restype, pBuf->resval.rint);
break;
case RTREAL:
if (pBuf->restype == RTREAL)
acutPrintf(_T("RTREAL : %0.3f\n"), pBuf->resval.rreal);
else
acutPrintf(_T("(%d . %0.3f)\n"), pBuf->restype, pBuf->resval.rreal);
break;
case RTSTR:
if (pBuf->restype == RTSTR)
acutPrintf(_T("RTSTR : %s\n"), pBuf->resval.rstring);
else
acutPrintf(_T("(%d . \"%s\")\n"), pBuf->restype,
pBuf->resval.rstring);
break;
case RT3DPOINT:
if (pBuf->restype == RT3DPOINT)
acutPrintf(_T("RT3DPOINT : %0.3f, %0.3f, %0.3f\n"),
pBuf->resval.rpoint[X], pBuf->resval.rpoint[Y],
pBuf->resval.rpoint[Z]);
else
acutPrintf(_T("(%d %0.3f %0.3f %0.3f)\n"), pBuf->restype,
pBuf->resval.rpoint[X], pBuf->resval.rpoint[Y],
pBuf->resval.rpoint[Z]);
break;
case RTNONE:
acutPrintf(_T("RTNONE\n"));
break;
case RTPOINT:
acutPrintf(_T("RTPOINT : %0.3f, %0.3f\n"), pBuf->resval.rpoint[X], pBuf->resval.rpoint[Y]);
break;
case RTANG:
acutPrintf(_T("RTANG : %0.3f\n"), pBuf->resval.rreal);
break;
case RTENAME:
acutPrintf(_T("RTENAME : <Entity name: %8lx>\n"), pBuf->resval.rlname[0]);
break;
case RTPICKS:
acutPrintf(_T("RTPICKS : unknown data format\n"));
break;
case RTORINT:
acutPrintf(_T("RTORINT : unknown data format\n"));
break;
case RTLONG:
acutPrintf(_T("RTLONG : %dl\n"), pBuf->resval.rlong);
break;
case RTVOID:
acutPrintf(_T("RTVOID\n"));
break;
case RTLB:
acutPrintf(_T("RTLB\n"));
break;
case RTLE:
acutPrintf(_T("RTLE\n"));
break;
case RTDOTE:
acutPrintf(_T("RTDOTE\n"));
break;
#ifdef RTDOT /* Not available in R11 */
case RTDOT:
acutPrintf(_T("RTDOT\n"));
break;
#endif
case RTNIL:
acutPrintf(_T("RTNIL\n"));
break;
#ifdef RTT /* Not available in R11 */
case RTT:
acutPrintf(_T("RTT\n"));
break;
#endif
case -1:
case -2: /* First block entity */
acutPrintf(_T("(%d . <Entity name: %8lx>)\n"), pBuf->restype, pBuf->resval.rlname[0]);
break;
case -3: /* marks start of xdata */
acutPrintf(_T("(-3)\n"));
}
/* if ((i == 23) && (pBuf->rbnext != NULL)) {
i = 0;
acedGetString(0,_T("Press <ENTER> to continue..."), buf);
}*/
}
return RTNORM;
}
static int printdxf(struct resbuf *eb)
{
int rt;
if (eb == NULL)
return RTNONE;
if ((eb->restype >= 0) && (eb->restype <= 9))
rt = RTSTR ;
else if ((eb->restype >= 10) && (eb->restype <= 19))
rt = RT3DPOINT;
else if ((eb->restype >= 38) && (eb->restype <= 59))
rt = RTREAL ;
else if ((eb->restype >= 60) && (eb->restype <= 79))
rt = RTSHORT ;
else if ((eb->restype >= 210) && (eb->restype <= 239))
rt = RT3DPOINT ;
else if (eb->restype < 0)
// Entity name (or other sentinel)
rt = eb->restype;
else if (eb->restype == 303)
rt = RTSTR ;
else if (eb->restype == 360)
rt = RTSTR ;
else
rt = RTNONE;
switch (rt) {
case RTSHORT:
acutPrintf(_T("(%d . %d)\n"), eb->restype,
eb->resval.rint);
break;
case RTREAL:
acutPrintf(_T("(%d . %0.3f)\n"), eb->restype,
eb->resval.rreal);
break;
case RTSTR:
acutPrintf(_T("(%d . \"%s\")\n"), eb->restype,
eb->resval.rstring);
break;
case RT3DPOINT:
acutPrintf(_T("(%d . %0.3f %0.3f %0.3f)\n"),
eb->restype,
eb->resval.rpoint[X], eb->resval.rpoint[Y],
eb->resval.rpoint[Z]);
break;
case RTNONE:
acutPrintf(_T("(%d . Unknown type)\n"), eb->restype);
break;
case -1:
case -2:
// First block entity
acutPrintf(_T("(%d . <Entity name: %8lx>)\n"),
eb->restype, eb->resval.rlname[0]);
}
return eb->restype;
} |
|