Ejemplo n.º 1
0
// Fill in all the data in the polygon counter dialog.
void
PolygonCounter::DrawBars()
{
    TSTR buf;
    int val;

    GetAppData(thePolyCounter.ip, MAX_POLYS_ID, _T("10000"), buf);
	if (atoi(buf, val))
		thePolyCounter.maxPolys->SetValue(val, FALSE);
    GetAppData(thePolyCounter.ip, MAX_SELECTED_ID, _T("1000"), buf);
	if (atoi(buf, val))
		thePolyCounter.maxSelected->SetValue(val, FALSE);

    HWND hName = GetDlgItem(thePolyCounter.hDlg, IDC_POLY_COUNT);
    TCHAR str[256];
    _stprintf(str, _T("%d"), faceCount);
    Static_SetText(hName, str);
    
    hName = GetDlgItem(thePolyCounter.hDlg, IDC_SEL_COUNT);
    _stprintf(str, _T("%d"), selFaceCount);
    Static_SetText(hName, str);

    HWND hPolyBar = GetDlgItem(hDlg, IDC_POLY_BAR);
    int maxFaces = maxPolys->GetIVal();
    DrawBar(hPolyBar, faceCount, maxFaces);
    HWND hSelBar = GetDlgItem(hDlg, IDC_SELECTED_BAR);
    int maxSel = maxSelected->GetIVal();
    DrawBar(hSelBar,  selFaceCount, maxSel);
}
Ejemplo n.º 2
0
std::string getConfigHome() {
#if defined(_WIN32)
	return GetAppData();
#elif defined(__APPLE__)
	return GetMacFolder(kApplicationSupportFolderType, "Failed to find the Application Support Folder");
#else
	return getLinuxFolderDefault("XDG_CONFIG_HOME", ".config");
#endif
}
Ejemplo n.º 3
0
std::string getDataHome() {
#if defined(_WIN32)
	return GetAppData();
#elif defined(__APPLE__)
	return GetMacFolder(kApplicationSupportFolderType, "Failed to find the Application Support Folder");
#else
	return getLinuxFolderDefault("XDG_DATA_HOME", ".local/share");
#endif
}
Ejemplo n.º 4
0
SysAllocStringByteLen(const char FAR* psz, unsigned int len)
{
    BSTR bstr;
    IMalloc FAR* pmalloc;
    DWORD cbTotal;
#if CACHE
    APP_DATA *pappdata;
#endif //CACHE
    
#if ROUNDUP
    cbTotal = ((DWORD)len + sizeof(DWORD) + 2L + ALLOC_ALIGN) & ALIGN_MASK;
#else //ROUNDUP
    cbTotal = (DWORD)len + sizeof(DWORD) + sizeof(OLECHAR);
#endif //ROUNDUP

#if CACHE
#if PROFILE
    g_cAllocTot++;
#endif //PROFILE
    if (FAILED(GetAppData(&pappdata)))
	return NULL;
    if (pappdata->m_cbFreeBlock >= cbTotal) {
	// found big enough block in cache
	bstr = pappdata->m_pbFreeBlock;
	pappdata->m_cbFreeBlock = 0;
#if PROFILE
	g_cAllocHits++;
#endif //PROFILE
	goto GotBlock;
    }
    pmalloc = pappdata->m_pimalloc;
#else //CACHE
    if(GetMalloc(&pmalloc) != NOERROR)
      return NULL;
#endif //CACHE

    bstr = (BSTR)pmalloc->Alloc(cbTotal);

    if(bstr != NULL){
#if CACHE
GotBlock:
#endif //CACHE
	*(DWORD FAR*)bstr = (DWORD)len;

	bstr = (WCHAR*) ((char*) bstr + sizeof(DWORD));

	if(psz != NULL){
	 MEMCPY(bstr, psz, len);
	}

	*(WCHAR UNALIGNED*)((char *)bstr + len) = L'\0';
			// always 0 terminate with a WIDE zero
    }

    return bstr;
}
USHORT FmtEnums( Trec *tp,char **pcp,ULONG UserAddr,UINT mid,
                 USHORT typeno,UINT sfx)
{
 char   *ename;
 UINT    size;
 USHORT  type;
 long    lvalue;
 long   *dp;
 UINT    read;
 ULONG   index;

 /****************************************************************************/
 /* - Get the type of the enum.                                              */
 /* - Get the size of the enum.                                              */
 /* - Get the value of the enum.                                             */
 /****************************************************************************/
 type = ((TD_ENUM*)tp)->DataType;
 size = QtypeSize(mid,type);

 dp = (signed long *)GetAppData( UserAddr, size, &read, sfx);
 if( !dp || (size != read) )
 {
  sprintf(*pcp,"Invalid Address");
  *(strchr(*pcp,'\0')) = ' ';
  return(0);
 }

 if( size == 1 )
     lvalue = (long)(*(UCHAR *)dp);
 else if( size == 2)
     lvalue = (long)(*(USHORT *)dp);
 else if( size == 4)
     lvalue = *dp;

 /***************************************************************************/
 /* - Get the name list index.                                              */
 /* - Find the name associated with the enum value(lvalue) and format it.   */
 /***************************************************************************/
 typeno = ((TD_ENUM*)tp)->NameListIndex;

 tp = QbasetypeRec(mid, typeno);
 if( tp && QNameList(tp,VERIFYVALUE,lvalue) )
 {
  index =  QNameList(tp,VALUEINDEX,lvalue);
  ename =  (char*)QNameList(tp,NAME,index);
  memcpy(*pcp, ename+sizeof(USHORT/*2 byte name length*/), *ename );

  /***************************************************************************/
  /* bump the buffer pointer for the caller.                                 */
  /***************************************************************************/
  *pcp = *pcp + *ename;
 }
 return(type);
}
void FmtString( char *cp, char *cpend ,ULONG UserAddr, UINT sfx )
{
 UINT   read = 0;
 UINT   size;
 UCHAR *dp;
 int    c;

 /****************************************************************************/
 /*                                                                          */
 /*         read                                                             */
 /*      |<------------------>|                                              */
 /*      |                    |                                              */
 /*         size                                                             */
 /*      |<------------------------------------------------->|               */
 /*      |                                                   |               */
 /*       ---------------------------------------------------                */
 /*      |                                                   |               */
 /*       ---------------------------------------------------                */
 /*       |                   |                             |                */
 /*       |                   |                             |                */
 /*      cp                   cpend( if size<read)          cpend            */
 /*                                                                          */
 /****************************************************************************/

 size = cpend-cp;
 dp = ( UCHAR *)GetAppData( UserAddr, size, &read, sfx);
 if( !dp || read==0 )
  {sprintf(cp,"Invalid Address");return;}

 if( read < size )
  cpend = cp + read;

 *cp = '\"';
 for( cp++; cp<=cpend && *dp != '\0'; cp++,dp++)
 {
  c = *dp;
  /***************************************************************************/
  /* show graphic characters as little dots.                                 */
  /***************************************************************************/
  if( c < 0x20 || c > 0x7F )
   *cp = 0xFA;
  else
   *cp = c;
 }
 if( cp <= cpend )
  *cp = '\"';

 /****************************************************************************/
 /* null terminate the string just formatted.                                */
 /****************************************************************************/
 cp++; if( cp <= cpend ) *cp = '\0';
}
void FmtShort( char *cp, ULONG UserAddr, UINT sfx , USHORT typeno )
{
 UINT   read;
 UINT   size;
 signed short *dp;
 char   fs[10] = "%-12d%#hx";

 size = sizeof(short);
 dp = (signed short *)GetAppData( UserAddr, size, &read, sfx);
 if( !dp || (size != read) )
  {sprintf(cp,"Invalid Address");return;}

 if( (typeno & TYP_BITS) == SIGNED )
  sprintf(cp,fs,*dp,(USHORT)*dp);
 else
  sprintf(cp,fs,(USHORT)*dp,(USHORT)*dp);
}
void FmtRef( char *cp, ULONG UserAddr, UINT sfx )
{
 UINT   read;
 UINT   size;
 signed long *dp;

 size = sizeof(long);
 dp = (signed long *)GetAppData( UserAddr, size, &read, sfx);
 if( !dp || (size != read) )
 {
  sprintf(cp,"Invalid Address");
 }
 else
 {
  sprintf(cp, "%#lx...Reference", (ULONG)*dp );
 }
 *(strchr(cp,'\0')) = ' ';
}
void FmtChar( char *cp, ULONG UserAddr, UINT sfx , USHORT typeno )
{
 UINT   read;
 UINT   size;
 signed char *dp;
 char   fs[10] = "%-12d";
 char   f2[4] = "%#x";
 char   f3[5] = "\'%c\'";

 size = sizeof(char);
 dp = (signed char *)GetAppData( UserAddr, size, &read, sfx);
 if( !dp || (size != read) )
  {sprintf(cp,"Invalid Address");return;}

 (*dp < 32 )? strcat(fs,f2):strcat(fs,f3);
 if( typeno == TYPE_CHAR )
  sprintf(cp,fs,*dp,(UCHAR)*dp);
 else
  sprintf(cp,fs,(UCHAR)*dp,(UCHAR)*dp);

}
void FmtFloat( UINT mid,char *cp, ULONG UserAddr, UINT sfx , USHORT typeno )
{
 UINT   read;
 UINT   size;
 signed long *dp;

 size = QtypeSize(mid,typeno);
 dp = (signed long *)GetAppData( UserAddr, size, &read, sfx);
 if( !dp || (size != read) )
  {sprintf(cp,"Invalid Address");return;}

 /****************************************************************************/
 /* Mask all the floating point exceptions while we execute the sprintf.     */
 /* The debugger may trap if we don't do this.                               */
 /*                                                                          */
 /****************************************************************************/
 _control87(0x37f,0xffff);
 switch(typeno)
 {
  case TYPE_FLOAT:
   sprintf(cp,"%.10g",*(float*)dp);
   break;

  case TYPE_DOUBLE:
   sprintf(cp,"%.18g",*(double*)dp);
   break;

  case TYPE_LDOUBLE:
   sprintf(cp,"%.21Lg",*(long double*)dp);
   break;
 }
 /****************************************************************************/
 /* - Clear any exceptions that may have occurred.                           */
 /* - Reset the control word to the default value.                           */
 /****************************************************************************/
 _clear87();
 _control87(CW_DEFAULT,0xffff);
}
void FmtBytes( char *cp, ULONG UserAddr, UINT sfx , UINT size )
{
 UINT   read;
 int    i;
 UCHAR *dp;

 dp = ( UCHAR *)GetAppData( UserAddr, size, &read, sfx);
 if( !dp || (size != read) )
 {
  sprintf(cp,"Invalid Address");
 }
 else
 {
  *cp = '\0';
  for( i=0; i < read; i++,dp++)
  {
   char buffer[4];

   sprintf(buffer, "%02X ", *dp);
   strcat( cp, buffer );
  }
 }
}
void FmtLong( char *cp, ULONG UserAddr, UINT sfx , USHORT typeno )
{
 UINT   read;
 UINT   size;
 signed long *dp;
 char   fs[11];

 size = sizeof(long);
 dp = (signed long *)GetAppData( UserAddr, size, &read, sfx);
 if( !dp || (size != read) )
  {sprintf(cp,"Invalid Address");return;}

 if( (typeno & TYP_BITS) == SIGNED )
 {
  strcpy(fs,"%-12ld%#lx");
  sprintf(cp,fs,*dp,(ULONG)*dp);
 }
 else
 {
  strcpy(fs,"%-12lu%#lx");
  sprintf(cp,fs,(ULONG)*dp,(ULONG)*dp);
 }
}
Ejemplo n.º 13
0
// Handler for the modeless polygon counter dialog.
static INT_PTR CALLBACK
PolyCountDlgProc(HWND hDlg, UINT msg, WPARAM wParam,
                              LPARAM lParam) 
{
    TSTR buf;
    int val;

    switch (msg) {
    case WM_INITDIALOG:
        thePolyCounter.hDlg = hDlg;
        CenterWindow(hDlg, GetParent(hDlg));
        thePolyCounter.maxPolys =
            GetISpinner(GetDlgItem(hDlg, IDC_MAX_POLY_SPIN));
        thePolyCounter.maxPolys->SetScale(10.0f);
        thePolyCounter.maxPolys->SetLimits(0, 1000000);
        thePolyCounter.maxPolys->LinkToEdit(GetDlgItem(hDlg,
                                                       IDC_MAX_POLY_EDIT),
                                            EDITTYPE_INT);
        thePolyCounter.maxPolys->SetResetValue(10000);
        GetAppData(thePolyCounter.ip, MAX_POLYS_ID, _T("10000"), buf);
        if (atoi(buf, val))
            thePolyCounter.maxPolys->SetValue(val, FALSE);

        thePolyCounter.maxSelected =
            GetISpinner(GetDlgItem(hDlg, IDC_MAX_SELECTED_SPIN));
        thePolyCounter.maxSelected->SetScale(10.0f);
        thePolyCounter.maxSelected->SetLimits(0, 1000000);
        thePolyCounter.maxSelected->LinkToEdit(GetDlgItem(hDlg,
                                                    IDC_MAX_SELECTED_EDIT),
                                               EDITTYPE_INT);
        thePolyCounter.maxSelected->SetResetValue(1000);
        GetAppData(thePolyCounter.ip, MAX_SELECTED_ID, _T("1000"), buf);
		if (atoi(buf, val))
			thePolyCounter.maxSelected->SetValue(val, FALSE);

		CheckRadioButton(hDlg, IDC_TRIANGLE, IDC_POLY, IDC_TRIANGLE);
		
		countTriangles = IsDlgButtonChecked(hDlg, IDC_TRIANGLE);

        InitFaceCount();
        CountFaces(thePolyCounter.ip);
        break;
    case CC_SPINNER_CHANGE:
    case WM_CUSTEDIT_ENTER:
        val = thePolyCounter.maxPolys->GetIVal();
        buf.printf(_T("%d"), val);
        WriteAppData(thePolyCounter.ip, MAX_POLYS_ID, buf);
        val = thePolyCounter.maxSelected->GetIVal();
        buf.printf(_T("%d"), val);
        WriteAppData(thePolyCounter.ip, MAX_SELECTED_ID, buf);
		// fall through
    case WM_PAINT:
        thePolyCounter.DrawBars();
        break;
    case WM_COMMAND:
        switch(LOWORD(wParam)) {
		case IDC_TRIANGLE:
			countTriangles = IsDlgButtonChecked(hDlg, IDC_TRIANGLE);
			InitFaceCount();
			CountFaces(thePolyCounter.ip);
			thePolyCounter.DrawBars();
			break;
		case IDC_POLY:
			countTriangles = !(IsDlgButtonChecked(hDlg, IDC_POLY));
			InitFaceCount();
			CountFaces(thePolyCounter.ip);
			thePolyCounter.DrawBars();
			break;
        case IDCANCEL:
            EndDialog(hDlg, FALSE);
            ReleaseISpinner(thePolyCounter.maxPolys);
            ReleaseISpinner(thePolyCounter.maxSelected);
            if (thePolyCounter.iu)
                thePolyCounter.iu->CloseUtility();
            thePolyCounter.hDlg = NULL;
            thePolyCounter.End();
            break;
        }
    }
    return FALSE;
        
}
Ejemplo n.º 14
0
SysAllocStringLen(const OLECHAR FAR* psz, unsigned int len)
{
    BSTR bstr;
    IMalloc FAR* pmalloc;
    DWORD cbTotal;
#if CACHE
    APP_DATA *pappdata;
#endif //CACHE

#if OE_WIN32
#if ROUNDUP
    cbTotal = ((DWORD)len*2 + sizeof(DWORD) + 2L + ALLOC_ALIGN) & ALIGN_MASK;
#else //ROUNDUP
    cbTotal = (DWORD)len*2 + sizeof(DWORD) + 2L;
#endif //ROUNDUP
#else
    cbTotal = (DWORD)len + sizeof(DWORD) + 1L;
#endif

#if OE_WIN16
    // BSTRs are limited to 64k on Win16
    if(cbTotal > 65535)
      return NULL;
#endif

#if CACHE
#if PROFILE
    g_cAllocTot++;
#endif //PROFILE
    if (FAILED(GetAppData(&pappdata)))
	return NULL;
    if (pappdata->m_cbFreeBlock >= cbTotal) {
	// found big enough block in cache
	bstr = pappdata->m_pbFreeBlock;
	pappdata->m_cbFreeBlock = 0;
#if PROFILE
	g_cAllocHits++;
#endif //PROFILE
	goto GotBlock;
    }
    pmalloc = pappdata->m_pimalloc;

#else //CACHE
    if(GetMalloc(&pmalloc) != NOERROR)
      return NULL;
#endif //CACHE

    bstr = (BSTR)pmalloc->Alloc(cbTotal);

    if(bstr != NULL){
#if OE_WIN16
      // Even if IMalloc was able to allocate the ammount we asked
      // for, we need to make sure that there is enough room in the
      // first segment of the allocation for the string, because BSTRs
      // aren't HUGE pts on Win16.
      //
      if(!ROOMINSEG(bstr, cbTotal))
      {
	pmalloc->Free(bstr);
	bstr = NULL;
      }
      else
#endif

#if CACHE
GotBlock:
#endif //CACHE

      {
#if OE_WIN32
	*(DWORD FAR*)bstr = (DWORD)len*2;

	bstr = (WCHAR*) ((char*) bstr + sizeof(DWORD));

	if(psz != NULL){
	 MEMCPY(bstr, psz, len*2);
	}

	bstr[len] = L'\0'; // always 0 terminate
	
#else
	*(DWORD FAR*)bstr = (DWORD)len;

	bstr += sizeof(DWORD);

	if(psz != NULL){
	  MEMCPY(bstr, psz, len);
	}

	bstr[len] = '\0'; // always 0 terminate
#endif          
		
      }
    }

    return bstr;
}
void FmtBitField( Trec *ptrec, char *cp, ULONG UserAddr, UINT sfx)
{
 TD_BITFLD *tp;                        /* -> to base type record.            */
 UCHAR      type;                      /* type of bitfld storage.            */
 UCHAR      bitfldsize;                /* size of bitfld storage.            */
 UCHAR      bitfldoffs;                /* offset of bitfld within stg.       */
 UCHAR      size;                      /* size of bitfld storage.            */
 UCHAR      offset;                    /* offset of bitfld within stg.       */
 UCHAR      width;                     /* width  of bitfld within stg.       */
 UINT       value;                     /* unsigned value for bitfld.         */
 UCHAR      byteval;                   /* byte value of bit field.           */
 UCHAR      bytemask;                  /* byte mask for bitfield.            */
 int        i;
 int        j;
 UCHAR      fmtmask;                   /* storage mask for bitfld.           */
 UCHAR     *dp;
 UINT       read;
 int        bitsconsumed;

 tp = (TD_BITFLD*)ptrec;

 bitfldsize = tp->BitSize;
 bitfldoffs = tp->Offset;
 type       = tp->BaseType;
 if( type == TYPE_ULONG && (tp->Flags & DISPLAY_AS_VALUE ) )
  type = TYPE_ULONG_8;

 size = bitfldsize;
 offset = bitfldoffs;
 switch( type )
 {
  case TYPE_UCHAR:
  /*************************************************************************/
  /* PL/X bit fields.                                                      */
  /*************************************************************************/
  {
   width = 8;

   bitsconsumed = 0;
   j = 0;
   for(;;)
   {
    if(size+offset>width)
    {
     size = width - offset;
    }

    for( i=0; i< (int)width ; i++ )
     if( (i+j)<MAXPLXBITSTRINGLENGTH )
      cp[j+i] = '.';
    bytemask=(UCHAR)( (bytemask=0x7F)>>(size-1) );
    bytemask=(UCHAR)((UCHAR)(~bytemask)>>offset );
    dp = GetAppData(UserAddr,1,&read,sfx);
    if( !dp || (read != 1 ) )
     {sprintf(cp,"Invalid Address");return;}

    byteval = bytemask & (*dp);
    fmtmask = 0x80;
    for( i=0;
         i< (int)width;
         fmtmask >>=1, i++)
    {
     if( bytemask & fmtmask )
     {
      if( (i+j)<MAXPLXBITSTRINGLENGTH )
       cp[j+i] = (UCHAR)((fmtmask & byteval)?'1':'0');
     }
    }
    j += i;
    bitsconsumed += (int)size;
    if(bitsconsumed >= (int)bitfldsize)
     break;
    size = bitfldsize - (UCHAR)bitsconsumed;   /* ?????????????? */
    offset = 0;
    UserAddr++;
   }
  }
  break;

  case TYPE_USHORT:
  /**********************************************************************/
  /* C211/C600 bitfields.                                               */
  /**********************************************************************/
  {
   USHORT mask;
   USHORT usfmtmask;

   width = 16;
   for( i=0; i< (int)width ; i++ )
    cp[i] = '.';
   mask = (~(mask = 1))<<(size-1);
   mask = (~mask)<<offset;

   dp = GetAppData(UserAddr,2,&read,sfx);
   if( !dp || (read != 2 ) )
    {sprintf(cp,"Invalid Address");return;}

   value = mask & (*(USHORT*)dp);
   usfmtmask = 0x8000;
   for( i=0; i< (int)width ; usfmtmask >>=1, i++ )
   {
    if( mask & usfmtmask )
     cp[i] = (UCHAR)((usfmtmask & value)?'1':'0');
   }
  }
  break;

  case TYPE_ULONG:
  /**********************************************************************/
  /* CL386 bitfields.                                                   */
  /**********************************************************************/
  {
   ULONG mask;
   ULONG ulfmtmask;

   width = 32;
   for( i=0; i< (int)width ; i++ )
    cp[i] = '.';
   mask = (~(mask = 1))<<(size-1);
   mask = (~mask)<<offset;

   dp = GetAppData(UserAddr,4,&read,sfx);
   if( !dp || (read != 4 ) )
    {sprintf(cp,"Invalid Address");return;}

   value = mask & (*(ULONG*)dp);
   ulfmtmask = 0x80000000;
   for( i=0; i< (int)width ; ulfmtmask >>=1, i++ )
   {
      if( mask & ulfmtmask )
       cp[i] = (UCHAR)((ulfmtmask & value)?'1':'0');
   }
  }
  break;

  case TYPE_ULONG_8:
  /**********************************************************************/
  /* IBM C SET-2 Bitfields.                                             */
  /**********************************************************************/
  {
   if ( (size > 8) || ((offset+size) > 8) )
   {
    /********************************************************************/
    /* If the bit field spans across bytes then we will not be able     */
    /* show the exact memory lay out of bits since they are packed      */
    /* and filled from lower order bits to higher order bits.           */
    /* In this case we convert the bit string into Hex value and show   */
    /* it as a bit string.                                              */
    /********************************************************************/
    UINT uifmtmask;
    if (!BytesToValue(UserAddr,offset,size,sfx,&value))
       return;
    uifmtmask = 0x1;
    for( i=0; i< (int)size; uifmtmask <<=1, i++)
    {
     if( value & uifmtmask )
       cp[size-i-1] = (UCHAR)'1';
     else
       cp[size-i-1] = (UCHAR)'0';
    }
   }
   else
   {
    /********************************************************************/
    /* If the bit field doesn't span across a byte then show the        */
    /* exact memory lay out of bits.                                    */
    /********************************************************************/
    width = 8;
    for( i=0; i< (int)width ; i++ )
      cp[i] = '.';
    bytemask=(UCHAR)( (~(bytemask = 1))<<(size-1) );
    bytemask=(UCHAR)((UCHAR)(~bytemask)<<offset );
    dp = GetAppData(UserAddr,1,&read,sfx);
    if( !dp || (read != 1 ) )
     {sprintf(cp,"Invalid Address");return;}

    byteval = bytemask & (*dp);
    fmtmask = 0x80;
    for( i=0; i< (int)width; fmtmask >>=1, i++)
    {
     if( bytemask & fmtmask )
       cp[i] = (UCHAR)((fmtmask & byteval)?'1':'0');
    }
   }
  }
  break;
 }                                     /* end of switch{}.                  */
 return;
}
USHORT FmtPtr(char **pcp,ULONG *pUserAddr,UINT mid, USHORT typeno,UINT sfx)
{
 UINT    read;
 UINT    size;
 signed  char  **dp;
 ULONG   UserAddr = *pUserAddr;
 char   *cp = *pcp;
 UINT    type;

 type = GetPtrType(mid,typeno);
 size = QtypeSize(mid,typeno);

 switch( type )
 {
  case PTR_0_32:
  case PTR_16_16:
   dp = ( signed char**)GetAppData( UserAddr, size, &read, sfx);
   if( !dp || (size != read) )
    {sprintf(cp,"Invalid Address");return(0);}

   if( type == PTR_0_32 )
   {
    sprintf(cp,fs1,*dp);
    *pUserAddr = (ULONG)*dp;
   }
   else /* case PTR_16_16 */
   {
    sprintf(cp,fs2, *((USHORT*)dp+1),*(USHORT*)dp);
    *pUserAddr = Data_SelOff2Flat( *((USHORT*)dp+1) , *(USHORT*)dp );
   }
   break;

  case PTR_0_16:
   /**************************************************************************/
   /* - Convert a BP Relative location of the near pointer to a flat address */
   /*   if the 0:16 pointer is a stack variable.                             */
   /* - Get 2 bytes of offset from the location.                             */
   /* - Format the 0:16 pointer.                                             */
   /* - Get the selector where the pointer was defined. Since the pointer is */
   /*   near, the target of the pointer has to have the same selector.       */
   /* - Form the flat address value of the pointer.                          */
   /*                                                                        */
   /**************************************************************************/
   if( TestBit(UserAddr,STACKADDRBIT) )
    UserAddr = StackBPRelToAddr( UserAddr , sfx );
   if ( UserAddr == 0 )
    {sprintf(cp,"Invalid Address");return(0);}

   dp = ( signed char**)GetAppData( UserAddr, size, &read, sfx);
   if( !dp || (size != read) )
    {sprintf(cp,"Invalid Address");return(0);}
   sprintf(cp,fs3, *(USHORT*)dp);

   {
    USHORT Sel;
    USHORT Off;

    Data_Flat2SelOff(UserAddr, &Sel,&Off);
    *pUserAddr = Data_SelOff2Flat( Sel, *(USHORT*)dp);
   }
 }

 /****************************************************************************/
 /* - If the typeno is primitive, then zero the model bits and return        */
 /*   the type of the pointer to the caller.                                 */
 /* - If the typeno is complex, then echo the typeno back to the caller.     */
 /*   What we return is irrelevant;however, we need to return something.     */
 /****************************************************************************/
 if( typeno < 512 )
   typeno &= (~MD_BITS);

 /****************************************************************************/
 /* Append strings to type char and type uchar pointers.                     */
 /****************************************************************************/
 if( typeno == TYPE_CHAR || typeno == TYPE_UCHAR )
 {
  char *cpend;
  extern UINT VideoCols;

  cpend = (*pcp-STGCOL-1) + VideoCols - 1;
  FmtString(cp+strlen(cp),cpend,*pUserAddr,sfx);
  typeno = 0;
 }
 else
  /***************************************************************************/
  /* Kill the \0 at the end of the string by converting to a space.          */
  /***************************************************************************/
  *(*pcp=strchr(cp,'\0')) = ' ';

 return(typeno);
}