コード例 #1
0
ファイル: vastchkid.c プロジェクト: hsptools/hsp-wrap
/*---------------- to check if an identical chain exist ----------------*/
Boolean FindIdSlave(Char *pSegmentThis, BiostrucFeaturePtr pbsfHead, Int4 iCount1)
{
  Int4 iCount2 = 0;

  if(StringNCmp(pSegmentThis, pSegmentMaster, 5) == 0){
                         /* only compare PDB code and Chain Id */
     return TRUE;
  }
  else if(iCount1 == 0) {
     return FALSE;
  }

  iCount2 = 0;
  while(pbsfHead){
     if(iCount2 >= iCount1) return FALSE;
     if(StringNCmp(pSegmentThis, pbsfHead->name + 7, 5) == 0) {
                          /* only compare PDB code and Chain Id */
        return TRUE;
     }

     iCount2++;
     pbsfHead = pbsfHead->next;
  }

  return FALSE;

} 
コード例 #2
0
ファイル: gbseqget.c プロジェクト: hsptools/hsp-wrap
static void LookForSeqIDs (BioseqPtr bsp, Pointer userdata)

{
  LookForIDsPtr  lfip;
  SeqIdPtr       sip;
  TextSeqIdPtr   tsip;

  lfip = (LookForIDsPtr) userdata;
  if (ISA_na (bsp->mol)) {
    lfip->isNuc = TRUE;
  }
  if (ISA_aa (bsp->mol)) {
    lfip->isProt = TRUE;
  }
  for (sip = bsp->id; sip != NULL; sip = sip->next) {
    switch (sip->choice) {
      case SEQID_GENBANK :
      case SEQID_EMBL :
      case SEQID_DDBJ :
        lfip->isGED = TRUE;
        break;
      case SEQID_TPG :
      case SEQID_TPE :
      case SEQID_TPD :
        lfip->isTPA = TRUE;
        break;
      case SEQID_OTHER :
        tsip = (TextSeqIdPtr) sip->data.ptrvalue;
        if (tsip != NULL) {
          if (StringNCmp (tsip->accession, "NC_", 3) == 0) {
            lfip->isNC = TRUE;
          } else if (StringNCmp (tsip->accession, "NT_", 3) == 0) {
            lfip->isNTorNW = TRUE;
          } else if (StringNCmp (tsip->accession, "NW_", 3) == 0) {
            lfip->isNTorNW = TRUE;
          }
        }
        break;
      default :
        break;
    }
  }
}
コード例 #3
0
ファイル: cn3dmodl.c プロジェクト: hsptools/hsp-wrap
/*---------------------------------------------------------*/
void AssignDomainAlignedStatus(void)
{
    Int4 iCount = 0, iCountStruc = 0;
    PDNMS pdnmsMaster = NULL;
    PMSD pmsdMaster = NULL;
    BiostrucAnnotSetPtr pbsaThis = NULL;
    BiostrucFeatureSetPtr pbsfsThis = NULL;
    BiostrucFeaturePtr pbsfThis = NULL;

    Int2 iDomainMaster = 0, iDomainSlave = 0;

    pdnmsMaster = GetSelectedModelstruc();
    if (!pdnmsMaster)
        return;
    else
        pmsdMaster = pdnmsMaster->data.ptrvalue;

    pbsaThis = pmsdMaster->psaStrucAlignment;
    if (pbsaThis == NULL)
        return;
    pbsfsThis = pbsaThis->features;
    iDomainMaster = (Int2) (pbsfsThis->id % 100);

    for (iCount = 0; iCount < iDomainCount; iCount++) {
        pbsfThis = pbsfsThis->features;
        iCountStruc = 0;
        while (pbsfThis) {
            iDomainSlave =
                (Int2) (((pbsfThis->id - pbsfThis->id % 10) / 10) % 100);
            iCountStruc++;

            if (domaindata[iCount]->iStrucIndex == 0) {
                if (
                    (StringNCmp
                     (pbsfThis->name, domaindata[iCount]->pcPDBName,
                      4) == 0)
                    && (pbsfThis->name[4] ==
                        domaindata[iCount]->pcMolName[0])) {
/*            if((Char) pbsfThis->name[5] == '0'){   */
                    if (iDomainMaster == 0) {
                        domaindata[iCount]->bAligned = TRUE;
                    }
                        else if (iDomainMaster ==
                                 domaindata[iCount]->iDomain) {
                        domaindata[iCount]->bAligned = TRUE;
                    }
                }
            } else if (domaindata[iCount]->iStrucIndex == iCountStruc) {
                if (
                    (StringNCmp
                     (pbsfThis->name + 7, domaindata[iCount]->pcPDBName,
                      4) == 0)
                    && (pbsfThis->name[11] ==
                        domaindata[iCount]->pcMolName[0])) {
                    if (iDomainSlave == 0) {
                        domaindata[iCount]->bAligned = TRUE;
                    } else if (iDomainSlave == domaindata[iCount]->iDomain) {
                        domaindata[iCount]->bAligned = TRUE;
                    }
                }
            }

            pbsfThis = pbsfThis->next;
        }
    }

}
コード例 #4
0
ファイル: UIFont.cpp プロジェクト: BGCX261/zjh-dev-svn-to-git
// Create a font object from sFileName specified
bool UIFont::Create(const tchar* sFileName)
{
	if(NULL == sFileName)
	{
		return false;
	}

	void	*data;
	uint32	size;
	tchar	*desc, *pdesc;
	tchar	linebuf[256];
	tchar	buf[GT_PATH_MAX_LEN], *pbuf;
	tchar	chr;
	int32	i, x, y, w, h, a, c;

	// Setup variables
	fHeight = 0.0f;
	//fScale = 1.0f;
	fProportion = 1.0f;
	//fRot = 0.0f;
	fTracking = 0.0f;
	fSpacing = 1.0f;
	m_pTexture = NULL;

	fZ = 0.5f;
	//nBlend=BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_NOZWRITE;
	dwCol = 0xFFFFFFFF;

	ClearMemory(&letters, sizeof(letters));
	ClearMemory(&pre, sizeof(pre));
	ClearMemory(&post, sizeof(post));
	
	// Load font description
	data = GOS::LoadFileIntoMemory(sFileName, &size);
	if(NULL == data)
	{
		return false;
	}

	desc = new tchar[size+1];
	memcpy(desc,data,size);
	desc[size]=0;
	free(data);

	pdesc = _get_line(desc,linebuf);
	if(StringCmp(linebuf, FNTHEADERTAG))
	{
		delete[] desc;	
		return false;
	}

	// Parse font description

	while((pdesc = _get_line(pdesc,linebuf)))
	{
		if(!StringNCmp(linebuf, FNTBITMAPTAG, sizeof(FNTBITMAPTAG)-1 ))
		{
			StringCopy(buf, sFileName);
			pbuf = Strrchr(buf,CTEXT('\\'));
			if(!pbuf) pbuf = Strrchr(buf,CTEXT('/'));
			if(!pbuf) pbuf = buf;
			else pbuf++;
			if(!tsscanf(linebuf, CTEXT("Bitmap = %s"), pbuf)) continue;

			//m_pTexture = GameObjectCreation::CreateTexture2D(buf);
			if(NULL == m_pTexture)
			{
				delete[] desc;	
				return false;
			}
		}
		else if(!StringNCmp(linebuf, FNTCHARTAG, sizeof(FNTCHARTAG)-1 ))
		{
			pbuf = Strrchr(linebuf,CTEXT('='));
			if(!pbuf) continue;
			pbuf++;
			while(*pbuf==CTEXT(' ')) pbuf++;
			if(*pbuf==CTEXT('\"'))
			{
				pbuf++;
				i=*pbuf++;
				pbuf++; // skip "
			}
			else
			{
				i=0;
				while((*pbuf>=CTEXT('0') && *pbuf<=CTEXT('9')) ||
					(*pbuf>=CTEXT('A') && *pbuf<=CTEXT('F')) ||
					(*pbuf>=CTEXT('a') && *pbuf<=CTEXT('f')))
				{
					chr=*pbuf;
					if(chr >= CTEXT('a')) chr-=CTEXT('a')-CTEXT(':');
					if(chr >= CTEXT('A')) chr-=CTEXT('A')-CTEXT(':');
					chr-=CTEXT('0');
					if(chr>0xF) chr=0xF;
					i=(i << 4) | chr;
					pbuf++;
				}
				if(i<0 || i>255) continue;
			}
			tsscanf(pbuf, CTEXT(" , %d , %d , %d , %d , %d , %d"), &x, &y, &w, &h, &a, &c);

			letters[i].x = x;
			letters[i].y = y;
			letters[i].w = w;
			letters[i].h = h;

			pre[i]=(float)a;
			post[i]=(float)c;
			if(h>fHeight) fHeight=(float)h;
		}
	}

	delete[] desc;	

	return true;
}
コード例 #5
0
static Boolean LIBCALLBACK FirstVecScreenCallback (
  CONN conn,
  Nlm_VoidPtr userdata,
  EIO_Status  status
)

{
  VQueuePtr  cqp;
  FILE       *fp;
  Char       line [256];
  Char       path [PATH_MAX];
  CharPtr    rid;
  CharPtr    rtoe;
  CharPtr    str;
  long int   val;

  /* read rID or failure message */

  cqp = (VQueuePtr) userdata;

  TmpNam (path);
  fp = FileOpen (path, "w");
  QUERY_CopyResultsToFile (conn, fp);
  FileClose (fp);

  fp = FileOpen (path, "r");
  str = ReadALine (line, sizeof (line), fp);
  while (str != NULL) {
    if (! StringHasNoText (line)) {
      if (line [0] == '>') {
        if (StringNICmp (line, ">Vector", 7) == 0) {
          rid = StringStr (line, "RID: ");
          if (rid != NULL) {
            rid += 5;
            rtoe = StringStr (rid, " RTOE: ");
            if (rtoe != NULL) {
              *rtoe = '\0';
              rtoe += 7;
              StringNCpy_0 (cqp->rid, rid, sizeof (cqp->rid));
              if (sscanf (rtoe, "%ld", &val) == 1) {
                cqp->estTime = (time_t) val;
                cqp->secondsToWait = (Int2) val + 2;
              } else {
                cqp->secondsToWait = 15;
              }
              if (cqp->secondsToWait > 15) {
                cqp->secondsToWait = 15;
              }
              if (cqp->announceproc != NULL) {
                cqp->announceproc (rid, cqp->seqid, (Int2) val);
              }
            }
          } else if (StringStr (line, "FAILED") != NULL) {
            cqp->done = TRUE;
            if (cqp->resultproc != NULL) {
              cqp->resultproc (NULL, cqp->userdata, cqp->rid, cqp->seqid, FALSE);
            }
          }
        } else if (StringNICmp (line, ">Message", 8) == 0) {
          str = ReadALine (line, sizeof (line), fp);
          while (str != NULL && StringNCmp (line, "//", 2) != 0) {
            Message (MSG_POST, "%s\n", str);
            if (StringStr (line, "FAILURE") != NULL) {
              cqp->done = TRUE;
            }
            str = ReadALine (line, sizeof (line), fp);
          }
        }
      }
    }
    str = ReadALine (line, sizeof (line), fp);
  }
  FileClose (fp);

  FileRemove (path);

  return TRUE;
}
コード例 #6
0
static Boolean LIBCALLBACK SecondVecScreenCallback (
  CONN conn,
  Nlm_VoidPtr userdata,
  EIO_Status  status
)

{
  VQueuePtr  cqp;
  FILE       *fp;
  Char       line [256];
  Char       path [PATH_MAX];
  CharPtr    rid;
  CharPtr    sttus;
  CharPtr    str;
  Boolean    success = FALSE;
  Boolean    waiting = FALSE;

  /* look for waiting, failure, or success */

  cqp = (VQueuePtr) userdata;

  TmpNam (path);
  fp = FileOpen (path, "w");
  QUERY_CopyResultsToFile (conn, fp);
  FileClose (fp);

  fp = FileOpen (path, "r");
  str = ReadALine (line, sizeof (line), fp);
  while (str != NULL) {
    if (! StringHasNoText (line)) {
      if (line [0] == '>') {
        if (StringNICmp (line, ">Vector", 7) == 0) {
          rid = StringStr (line, "RID: ");
          if (rid != NULL) {
            rid += 5;
            sttus = StringStr (rid, " Status: ");
            if (sttus != NULL) {
              *sttus = '\0';
              sttus += 9;
              if (StringCmp (cqp->rid, rid) != 0) {
                ErrPostEx (SEV_ERROR, 0, 0, "RID mismatch '%s' vs '%s'", cqp->rid, rid);
                cqp->done = TRUE;
              } else if (StringStr (sttus, "FAILED") != NULL) {
                cqp->done = TRUE;
              } else if (StringStr (sttus, "unknown") != NULL) {
                ErrPostEx (SEV_ERROR, 0, 0, "RID unknown '%s'", rid);
                cqp->done = TRUE;
              } else if (StringStr (sttus, "SUCCESS") != NULL) {
                success = TRUE;
              } else if (StringStr (sttus, "WAITING") != NULL) {
                waiting = TRUE;
                /*
                Message (MSG_POST, "WAITING");
                */
              }
            }
          }
        } else if (StringNICmp (line, ">Message", 8) == 0) {
          str = ReadALine (line, sizeof (line), fp);
          while (str != NULL && StringNCmp (line, "//", 2) != 0) {
            Message (MSG_POST, "%s\n", str);
            if (StringStr (line, "FAILURE") != NULL) {
              if (! waiting) {
                cqp->done = TRUE;
              }
            }
            str = ReadALine (line, sizeof (line), fp);
          }
        }
      }
    }
    str = ReadALine (line, sizeof (line), fp);
  }
  FileClose (fp);

  if (success) {
    cqp->resultproc (path, cqp->userdata, cqp->rid, cqp->seqid, success);
    cqp->done = TRUE;
  } else if (cqp->done) {
    cqp->resultproc (NULL, cqp->userdata, cqp->rid, cqp->seqid, success);
  }

  FileRemove (path);

  return TRUE;
}