コード例 #1
0
ファイル: fetchent.c プロジェクト: hsptools/hsp-wrap
static void ReadPubMedRecords (LinkSetPtr lsp, FILE *fp)

{
  Int4                  count;
  Int2                  num;
  MedlineEntryPtr PNTR  list;  /* see <objmedli.h> */
  MedlineEntryPtr       mep;

  if (lsp == NULL || lsp->num == 0 || lsp->uids == NULL) return;
  list = (MedlineEntryPtr PNTR) MemNew (lsp->num * sizeof (MedlineEntryPtr));
  if (list != NULL) {

    /* EntrezMedlineEntryListGet get a maximum of 32767 records at once */
    num = EntrezMedlineEntryListGet (list, lsp->num, lsp->uids, FALSE);

    for (count = 0; count < num; count++) {
      mep = list [count];
      if (mep != NULL) {
        /* the following call saves the record in traditional MEDLINE format */
        if (MedlineEntryToDataFile (mep, fp)) {
          fprintf (fp, "\n\n");
        }
      }
    }

    for (count = 0; count < lsp->num; count++) {
      list [count] = MedlineEntryFree (list [count]);
    }
    MemFree (list);
  }
}
コード例 #2
0
ファイル: slri_sstack.c プロジェクト: iandonaldson/slri
/* Returns a concatenation of all stack contents */
CharPtr
SLRI_SSGetWholeString(SLRI_SStackPtr ssp)
{
  SLRI_SStackItemPtr ssipCurr = NULL;
  CharPtr wholeString = NULL;

  if (ssp == NULL) {
    ErrPostEx(SEV_ERROR, 0, 0, "SLRI_SSGetWholeString: stack pointer is NULL");
    return(NULL);
  }

  if (SLRI_SSIsEmpty(ssp)) {
    return(NULL);
  }

  wholeString = MemNew((ssp->totalStackSize + 1) * sizeof(Char));

  /* Initialize wholeString with first item */
  StringCpy(wholeString, ssp->bottom->string);

  /* Cycle through rest of stack to get remaining items */
  ssipCurr = ssp->bottom->next;
  while (ssipCurr != NULL) {
    StringCat(wholeString, ssipCurr->string);
    ssipCurr = ssipCurr->next;
  }

  return(wholeString);
}
コード例 #3
0
ファイル: vsmfile.c プロジェクト: hsptools/hsp-wrap
static void GetProtListCallback (BioseqPtr bsp, Pointer userdata)
{
  ValNodePtr PNTR   pList;
  SeqFeatPtr        sfp;
  SeqMgrFeatContext fcontext;
  ProtRefPtr        prp;
  AlphaProtPtr      app;
  
  if (bsp == NULL || userdata == NULL || ! ISA_aa (bsp->mol)) return;
  pList = (ValNodePtr PNTR) userdata;
  app = (AlphaProtPtr) MemNew (sizeof (AlphaProtData));
  if (app == NULL) return;
  app->bsp = bsp;
  app->prot_name = NULL;
  
  sfp = SeqMgrGetNextFeature (bsp, NULL, SEQFEAT_PROT, 0, &fcontext);
  if (sfp != NULL && sfp->data.value.ptrvalue != NULL) 
  {
    prp = (ProtRefPtr) sfp->data.value.ptrvalue;
    if (prp->name != NULL)
    {
      app->prot_name = StringSave (prp->name->data.ptrvalue);
    }
    else
    {
      app->prot_name = StringSave (fcontext.label);
    }
  }
  ValNodeAddPointer (pList, 0, app);
}
コード例 #4
0
ファイル: urkdust.c プロジェクト: hsptools/hsp-wrap
extern FloatHiPtr DustForGraph (DustRegionPtr drp, Int4 length,
                                Int4 start, Int4 stop)
{
    DustRegionPtr drphead;
    FloatHiPtr    fhi, fhead;
    Int4          i;

    if (drp == NULL)
        return NULL;
    if (stop > length)
        return NULL;


    drphead = drp;
    if ((fhead = (FloatHiPtr) MemNew ((size_t)((sizeof(FloatHi))*length)))
            == NULL)
        return NULL;

    while (drp != NULL)
    {
        fhi = fhead;
        if (drp->from >= start && drp->from < length && drp->to < length)
        {
            fhi += drp->from;
            for (i = drp->from; i <= drp->to; i++)
            {
                *fhi = drp->percent;
                fhi++;
            }
        }
        drp = drp->next;
    }
    return fhead;
}
コード例 #5
0
ファイル: slri_sstack.c プロジェクト: iandonaldson/slri
/* Pushes a StringStack item onto StringStack */
Int4 
SLRI_SSPush(SLRI_SStackPtr ssp, CharPtr string) 
{
  SLRI_SStackItemPtr newItem = NULL;

  if (ssp == NULL) {
    ErrPostEx(SEV_ERROR, 0, 0, "SLRI_SSPush: stack pointer is NULL");
    return(-1);
  }

  newItem = MemNew(sizeof(SLRI_SStackItem));

  newItem->string = string;
  newItem->prev = ssp->top;
  newItem->next = NULL; 

  if (ssp->top != NULL) {
    ssp->top->next = newItem;
  }

  ssp->top = newItem;
  ssp->totalStackSize += StringLen(newItem->string);
  ssp->totalNumItems++;

  /* If first item, set bottom pointer to top */
  if (ssp->bottom == NULL) {
    ssp->bottom = ssp->top;
  }

  return(0);
}
コード例 #6
0
ファイル: png.c プロジェクト: cahirwpz/demoscene
bool PngDecodeImage(PngT *png, PixBufT *pixbuf) {
  if (png->ihdr.interlace_method != 0) {
    LOG("Interlaced PNG not supported.");
  } else if (png->ihdr.bit_depth != 8) {
    LOG("Non 8-bit components not supported.");
  } else {
    uint32_t pixelWidth = GetPixelWidth(png);
    uint32_t length = png->ihdr.width * png->ihdr.height * pixelWidth;
    uint32_t dstLength = length + png->ihdr.height;
    uint8_t *encoded = MemNew(dstLength);

    MergeIDATs(png);

    LOG("Uncompressing the image.");

    Inflate(png->idat.data + 2, encoded);

    LOG("Decoding pixels.");

    ReconstructImage(pixbuf->data, encoded,
                     png->ihdr.width, png->ihdr.height, pixelWidth);

    MemUnref(encoded);

    return true;
  }

  return false;
}
コード例 #7
0
ファイル: png.c プロジェクト: cahirwpz/demoscene
/* Collapse multiple IDAT chunks into single one. */
static void MergeIDATs(PngT *png) {
  if (png->idat.next) {
    uint32_t length, i;
    uint8_t *data;
    IdatT *idat;

    for (idat = &png->idat, length = 0; idat; idat = idat->next)
      length += idat->length;

    LOG("Merged chunk length: %d.", length);

    data = MemNew(length);

    for (idat = &png->idat, i = 0; idat;) {
      IdatT *next = idat->next;

      MemCopy(data + i, idat->data, idat->length);
      i += idat->length;

      MemUnref(idat->data);
      if (idat != &png->idat)
        MemUnref(idat);

      idat = next;
    }

    png->idat.data = data;
    png->idat.length = length;
    png->idat.next = NULL;
  }
}
コード例 #8
0
ファイル: ncbimsg.c プロジェクト: fbtestrepo/hw
NLM_EXTERN MonitorPtr LIBCALL Nlm_MonitorIntNewEx (Nlm_CharPtr title, Nlm_Int4 n1, Nlm_Int4 n2, Nlm_Boolean hasCancelBtn)
{
	AppMsgInfo *info = GetAppMsgInfo();
	Monitor *pMon = (Monitor*) MemNew(sizeof(Monitor));

	if (pMon != NULL)
	{
		MON_SET_MAGIC(pMon);
		pMon->type = MonType_Int;
		pMon->strTitle = title ? StrSave(title) : 0;
		pMon->num1 = n1;
		pMon->num2 = n2;
		pMon->cancel = FALSE;
		pMon->hasCancelBtn = (int) hasCancelBtn;
		if (!(*info->hookMonitor)(pMon,MonCode_Create))
		{
		    MonitorFree(pMon);
		    /* only post an information message here; it is expected
		    	that the hook function would report the real reason
		    	that the monitor creation failed. */
			ErrPostEx(SEV_INFO,0,0,"Unable to create monitor");
			return NULL;
		}
	}
	return pMon;
}
コード例 #9
0
ファイル: ccpv.c プロジェクト: hsptools/hsp-wrap
static XOSPtr SetUp (void)
{
  static GatherScope  gs;
  GatherScopePtr      gsp;
  XOSPtr              xosp;

  gsp = &gs;
  MemSet ((Pointer) gsp, 0, sizeof (GatherScope));
  MemSet ((Pointer) gsp->ignore, (int) (TRUE),
          (size_t) (OBJ_MAX * sizeof (Boolean)));
  gsp->ignore[OBJ_BIOSEQ] = FALSE;

  xosp = MemNew (sizeof (XOS));

  xosp->flagParamWindow = FALSE;
  xosp->gi = 0;
  xosp->filename = NULL;
  xosp->gsp = gsp;
  xosp->sep = NULL;
  xosp->bsp = NULL;

  xosp->pccp = PccDatNew ();

  return xosp;
}
コード例 #10
0
ファイル: cnsrtv.c プロジェクト: hsptools/hsp-wrap
static XOSPtr SetUp (void)
{
  static GatherScope  gs;
  GatherScopePtr      gsp;
  XOSPtr              xosp;

  gsp = &gs;
  MemSet ((Pointer) gsp, 0, sizeof (GatherScope));
  MemSet ((Pointer) gsp->ignore, (int) (TRUE),
          (size_t) (OBJ_MAX * sizeof (Boolean)));
  gsp->ignore[OBJ_BIOSEQ] = FALSE;

  xosp = MemNew (sizeof (XOS));

  xosp->flagParamWindow = FALSE;
  xosp->gi = 0;
  xosp->filename = NULL;
  xosp->gsp = gsp;
  xosp->sep = NULL;
  xosp->bsp = NULL;
  xosp->xdeltamin = 1;
  xosp->xdeltamax = 64;
  xosp->xdeltaval = 20;
  xosp->ydeltamin = 1;
  xosp->ydeltamax = 64;
  xosp->ydeltaval = 20;
  xosp->treestyle = 0;

  return xosp;
}
コード例 #11
0
ファイル: idcleanscan.c プロジェクト: hsptools/hsp-wrap
static Boolean GetGraphsProc (GatherObjectPtr gop)

{
  GphGetPtr    ggp;
  GphItemPtr   gip;
  SeqGraphPtr  sgp;

  if (gop == NULL || gop->itemtype != OBJ_SEQGRAPH) return TRUE;
  ggp = (GphGetPtr) gop->userdata;
  sgp = (SeqGraphPtr) gop->dataptr;
  if (ggp == NULL || sgp == NULL) return TRUE;
  /* only phrap or gap4 currently allowed */
  if (StringICmp (sgp->title, "Phrap Quality") == 0 ||
      StringICmp (sgp->title, "Gap4") == 0) {
    /* data type must be bytes */
    if (sgp->flags[2] == 3) {
      if (SeqIdForSameBioseq (SeqLocId (sgp->loc), SeqLocId (ggp->slp))) {
        gip = (GphItemPtr) MemNew (sizeof (GphItem));
        if (gip == NULL) return TRUE;
        gip->sgp = sgp;
        gip->left = GetOffsetInBioseq (sgp->loc, ggp->bsp, SEQLOC_LEFT_END);
        gip->right = GetOffsetInBioseq (sgp->loc, ggp->bsp, SEQLOC_RIGHT_END);
        ValNodeAddPointer (&(ggp->vnp), 0, (Pointer) gip);
      }
    }
  }
  return TRUE;
}
コード例 #12
0
ファイル: taxcs.c プロジェクト: hsptools/hsp-wrap
Boolean tax_addNameClass(Int4 class_cde, CharPtr class_txt, Int4 priority)
{
    Int2 i;

    if(name_class == NULL) {
	name_class= MemNew(sizeof(TaxNameClass)*class_alloced);
	if(name_class == NULL) return FALSE;
	
	for(i= 0; i < class_alloced; i++) {
	    name_class[i].priority= 1000;
	    name_class[i].class_txt[0]= name_class[i].class_txt[33]= '\0';	    
	}
    }
    
    if(class_cde < 0) return FALSE;

    if(class_cde >= class_alloced) {
	TaxNameClassPtr tmp= MemMore(name_class, sizeof(TaxNameClass)*(class_cde + 8));

	if(tmp == NULL) return FALSE;
	
	name_class= tmp;
	for(i= class_alloced; i < class_cde + 8; i++) {
	    name_class[i].priority= 1000;
	    name_class[i].class_txt[0]= name_class[i].class_txt[33]= '\0';	    
	}
	class_alloced= class_cde + 8;
    }

    name_class[class_cde].priority= priority;
    StringNCpy(name_class[class_cde].class_txt, class_txt, 33);

    return TRUE;
}
コード例 #13
0
ファイル: taxcs.c プロジェクト: hsptools/hsp-wrap
Boolean tax_addRank(Int2 rank_id, CharPtr rank_txt)
{
    Int2 i;

    rank_id+= d_rank;

    if(tax_rank == NULL) {
	tax_rank= MemNew(sizeof(TaxRank)*rank_alloced);
	if(tax_rank == NULL) return FALSE;
	
	for(i= 0; i < rank_alloced; i++) {
	    tax_rank[i].rank_txt[0]= tax_rank[i].rank_txt[63]= '\0';	    
	}
    }
    
    if(rank_id < 0) return FALSE;

    if(rank_id >= rank_alloced) {
	TaxRankPtr tmp= MemMore(tax_rank, sizeof(TaxRank)*(rank_id + 8));

	if(tmp == NULL) return FALSE;
	
	tax_rank= tmp;
	for(i= rank_alloced; i < rank_id + 8; i++) {
	    tax_rank[i].rank_txt[0]= tax_rank[i].rank_txt[63]= '\0';	    
	}
	rank_alloced= rank_id + 8;
    }

    StringNCpy(tax_rank[rank_id].rank_txt, rank_txt, 63);

    return TRUE;
}
コード例 #14
0
ファイル: cdscan.c プロジェクト: hsptools/hsp-wrap
static void SeqEntryToFeat (SeqEntryPtr sep, FILE *fp)

{
  AsnExpOptPtr  aeop;
  AsnIoPtr      aip;
  ExpStructPtr  esp;

  if (sep != NULL && fp != NULL) {
    esp = MemNew (sizeof (ExpStruct));
    if (esp != NULL) {
      aip = AsnIoNullOpen ();
      if (aip != NULL) {
        esp->fp = fp;
        esp->aip = AsnIoNew (ASNIO_TEXT_OUT, fp, NULL, NULL, NULL);
        esp->is_na = is_na;
        esp->feat = 3;  /* look for CdRegion SeqFeat */
        aeop = AsnExpOptNew (aip, "Seq-feat", (Pointer) esp, GetSeqFeat);
        if (aeop != NULL) {
          SeqEntryAsnWrite (sep, aip, NULL);
          fflush (fp);
          AsnExpOptFree (aip, aeop);
        }
        AsnIoClose (aip);
      }
      MemFree (esp);
    }
  }
}
コード例 #15
0
ファイル: cdscan.c プロジェクト: hsptools/hsp-wrap
/*****************************************************************************
*
*   Add a new file list element
*
*****************************************************************************/
static FileListPtr FileListNew (FileListPtr flp, Int2 cdnum,
                                CharPtr fdir, CharPtr fname)

{
  FileListPtr  newnode;

  newnode = (FileListPtr) MemNew (sizeof (FileList));
  if (newnode != NULL) {
    if (flp != NULL) {
      while (flp->next != NULL && flp->next->cdnum <= cdnum) {
        flp = flp->next;
      }
      newnode->next = flp->next;
      flp->next = newnode;
    }
    newnode->cdnum = cdnum;
    if (fdir != NULL && *fdir != '\0') {
      newnode->fdir = StringSave (fdir);
    }
    if (fname != NULL && *fname != '\0') {
      newnode->fname = StringSave (fname);
    }
  }
  return newnode;
}
コード例 #16
0
ファイル: ni_lib_.c プロジェクト: hsptools/hsp-wrap
static NIOptions* s_GetNIOptions
(const Char *conf_file, const Char *conf_section)
{
  static TNlmTls s_NIOptionsTLS;

  NIOptions *nio;
  Char       conn_mode[64];

  if (NlmTlsGetValue(s_NIOptionsTLS, (VoidPtr *)&nio)
      &&  nio  &&  nio->interface != eNII_Default)
    return nio;

  if ( !nio )
    nio = (NIOptions *)MemNew(sizeof(NIOptions));

  NI_GetEnvParam(conf_file, conf_section, ENV_CONN_MODE,
                 conn_mode, sizeof(conn_mode), "");
  if (StringICmp(conn_mode, SERVICE_MODE) == 0)
    nio->interface = eNII_Service;
  else if (StringICmp(conn_mode, DEBUG_MODE) == 0)
    nio->interface = eNII_Debug;
  else
    nio->interface = NII_DEFAULT;

  if ( !NI_IsInterfaceSupported(nio->interface) )
    nio->interface = NII_DEFAULT;
  ASSERT ( NI_IsInterfaceSupported(nio->interface) );

  NlmTlsSetValue(&s_NIOptionsTLS, (VoidPtr)nio, s_NIOptionsTLS_Cleanup);
  return nio;
}
コード例 #17
0
ファイル: common.c プロジェクト: hilander/demoscene
DistortionMapT *NewDistortionMap(size_t width, size_t height,
                                 DistortionMapTypeT type,
                                 size_t textureW, size_t textureH)
{
  DistortionMapT *map = NewInstance(DistortionMapT);
  size_t size = 0;

  switch (type) {
    case DMAP_OPTIMIZED:
      size = sizeof(uint16_t);
      break;
    case DMAP_ACCURATE:
      size = sizeof(UV16T);
      break;
  }

  map->map = MemNew(size * width * height);
  map->type = type;
  map->width = width;
  map->height = height;
  map->textureW = textureW;
  map->textureH = textureH;

  return map;
}
コード例 #18
0
ファイル: tbl_chk.c プロジェクト: hsptools/hsp-wrap
static void MakeFetchItemIndex(ValNodePtr fetch_list)
{
  Int4 num;
  ValNodePtr tmp_list = NULL, prev = NULL, vnp, vnp_new;

  if (sFetchIndex != NULL) {
    sFetchIndex = MemFree (sFetchIndex);
    sFetchIndexSize = 0;
  }

  if (fetch_list == NULL) {
    return;
  }

  tmp_list = ValNodeNew (NULL);
  tmp_list->data.ptrvalue = fetch_list->data.ptrvalue;
  prev = tmp_list;
  for (vnp = fetch_list->next; vnp != NULL; vnp = vnp->next) {
    vnp_new = ValNodeNew (prev);
    vnp_new->data.ptrvalue = vnp->data.ptrvalue;
    prev = vnp_new;
  }

  tmp_list = ValNodeSort (tmp_list, SortVnpByFetchItem);
  sFetchIndexSize = ValNodeLen (tmp_list);
  sFetchIndex = (FetchItemPtr PNTR) MemNew (sizeof (FetchItemPtr) * sFetchIndexSize);
  for (vnp = tmp_list, num = 0; vnp != NULL; vnp = vnp->next, num++) {
    sFetchIndex[num] = vnp->data.ptrvalue;
  }
  tmp_list = ValNodeFree (tmp_list);
}
コード例 #19
0
NLM_EXTERN Boolean DoSequenceLengthsMatch (TAlignmentFilePtr afp)
{
  int     seq_index;
  int     curr_seg;
  Int4Ptr seq_len;
  Boolean rval;

  if (afp == NULL || afp->sequences == NULL || afp->num_sequences == 0) {
    return TRUE;
  }

  seq_len = (Int4Ptr) MemNew (sizeof (Int4) * afp->num_segments);
  if (seq_len == NULL) return FALSE;
  for (seq_index = 0; seq_index < afp->num_segments; seq_index ++)
  {
    seq_len [seq_index] = StringLen (afp->sequences[seq_index]);
  }

  curr_seg = 0;
  rval = TRUE;
  for (seq_index = afp->num_segments; seq_index < afp->num_sequences && rval; seq_index++) {
    if (StringLen (afp->sequences[seq_index]) != seq_len[curr_seg]) {
      rval = FALSE;
    }
	curr_seg ++;
	if (curr_seg >= afp->num_segments) curr_seg = 0;
  }
  MemFree (seq_len);
  return rval;
}
コード例 #20
0
ファイル: csan.c プロジェクト: iandonaldson/slri
static Int4  FillCSANWithStru(PCSAN pcsanThis, PMMD pmmdThis, Int4 iLen)
{
     Int4 iCount = 0;
     CharPtr pcA;
     PDNMG pdnmgThis = NULL;
     PMGD pmgdThis = NULL;


     if (!pcsanThis) return 0;
     if (!pmmdThis) return 0;
     if (!IsProtein(pmmdThis)) return 0;
     if (!iLen) return 0;

     pcsanThis->pcSeqAln = (CharPtr)MemNew((size_t) (1+ sizeof(char) * iLen));
     pcA = pcsanThis->pcSeqAln;
     pdnmgThis = pmmdThis->pdnmgHead;
     iCount = 0;
     while ((pdnmgThis != NULL)  && (iCount < iLen))
      {
            iCount++;
            pmgdThis = (PMGD) pdnmgThis->data.ptrvalue;
            *pcA = (char) pmgdThis->pcIUPAC[0] ;
            pcA++;
            pdnmgThis = pdnmgThis->next;
      }
     while (iCount < iLen)
       {
            *pcA = '-';
            pcA++;
            iCount++;
       }
    pcsanThis->pcSeqAln[iLen] = '\0';
    return iCount;
}
コード例 #21
0
ファイル: csan.c プロジェクト: iandonaldson/slri
PCSAN LIBCALL NewCSAN(void)
{
   PCSAN pcsanThis = NULL;

   pcsanThis = (PCSAN) MemNew((size_t)sizeof(CSAN));
   return pcsanThis;
}
コード例 #22
0
ファイル: urlquery.c プロジェクト: hsptools/hsp-wrap
NLM_EXTERN void QUERY_AddToQueue (
  QUEUE* queue,
  CONN conn,
  QueryResultProc resultproc,
  Nlm_VoidPtr userdata,
  Nlm_Boolean closeConn
)
{
  QueuePtr       cqp;
  QueuePtr PNTR  qptr;

  ASSERT (queue != NULL);

  if (conn == NULL || resultproc == NULL) return;

  /* allocate queue element */

  cqp = (QueuePtr) MemNew (sizeof (SConnQueue));
  if (cqp == NULL) return;

  cqp->conn = conn;
  cqp->resultproc = resultproc;
  cqp->userdata = userdata;
  cqp->closeConn = closeConn;
  cqp->protect = FALSE;

  /* add to polling queue */

  for (qptr = (QueuePtr PNTR) queue;  *qptr != NULL;  qptr = &(*qptr)->next);
  *qptr = cqp;
}
コード例 #23
0
ファイル: seqgraph.c プロジェクト: hsptools/hsp-wrap
static DialoG CreateCutoffsDialog (GrouP g, Uint2 rows, Int2 spacing,
                                   Boolean flagIsMatrix)
{
  EndPointsDialogPtr  epp;
  GrouP               g1, c, c1;
  PrompT              es, ee, em;
  TagListPtr          tlp;
  Uint2               columns;

  c = HiddenGroup (g, 0 , 0, NULL);
  epp = (EndPointsDialogPtr) MemNew (sizeof (EndPointsDialog));
  if (epp != NULL)
  {
    SetObjectExtra (c, epp, CleanupCutoffProc);
    epp->dialog = (DialoG) c;
    epp->todialog = EndPointValNodeToEndPointDialog;
    epp->fromdialog = EndPointDialogToEndPointValNode;
    epp->testdialog = NULL;
    epp->dialogmessage = NULL;

    g1 = HiddenGroup (c, -1, 0, NULL);
    SetGroupSpacing (g1, 4, 2);
    if (flagIsMatrix)
      c1 = HiddenGroup (g1, 3, 0, NULL);
    else
      c1 = HiddenGroup (g1, 2, 0, NULL);
    SetGroupSpacing (c1, spacing, spacing);
    es = StaticPrompt (c1, "Start", 0, 0, programFont, 'c');
    ee = StaticPrompt (c1, "End", 0, 0, programFont, 'c');
    if (flagIsMatrix)
    {
      em = StaticPrompt (c1, "Strand", 0, 0, programFont, 'c');
      columns = 3;
      ep_t = ep_types_m;
      ep_w = ep_width_m;
    }
    else
    {
      columns = 2;
      ep_t = ep_types_f;
      ep_w = ep_width_f;
    }
    epp->dep = CreateTagListDialog (g1, rows, columns, spacing,
                                    ep_t, ep_w, NULL,
                                    EndPointToDialog,
                                    DialogToEndPoint);
    tlp = (TagListPtr) GetObjectExtra (epp->dep);
    if (tlp != NULL)
    {
      AlignObjects (ALIGN_JUSTIFY, (HANDLE) tlp->control[0],
                                   (HANDLE) es, NULL);
      AlignObjects (ALIGN_JUSTIFY, (HANDLE) tlp->control[1],
                                   (HANDLE) ee, NULL);
      if (flagIsMatrix)
        AlignObjects (ALIGN_JUSTIFY, (HANDLE) tlp->control[2],
                                     (HANDLE) em, NULL);
    }
  }
  return (DialoG) c;
}
コード例 #24
0
ファイル: valdlg.c プロジェクト: hsptools/hsp-wrap
NLM_EXTERN DialoG CommentSetDialog (GrouP h)
{
  CommentSetDlgPtr dlg;
  GrouP             p;
  
  dlg = (CommentSetDlgPtr) MemNew (sizeof (CommentSetDlgData));
  if (dlg == NULL)
  {
    return NULL;
  }
  
  p = HiddenGroup (h, -1, 0, NULL);
  SetObjectExtra (p, dlg, CleanupCommentSetDialog);

  dlg->dialog = (DialoG) p;
  dlg->todialog = CommentSetToDialog;
  dlg->fromdialog = CommentSetFromDialog;

  SetupCommentSetDialogFont (dlg);
  dlg->rule_list_dlg = DocumentPanel (p, stdCharWidth * 50, stdLineHeight * 12);
  SetObjectExtra (dlg->rule_list_dlg, dlg, NULL);
  SetDocProcs (dlg->rule_list_dlg, ClickRulesDoc, NULL, NULL, NULL);
  SetDocShade (dlg->rule_list_dlg, NULL, NULL, RuleHighlight, NULL);

  dlg->rule_editor = CommentRuleDialog (p, UpdateRuleList, dlg);
  
  AlignObjects (ALIGN_CENTER, (HANDLE) dlg->rule_list_dlg, (HANDLE) dlg->rule_editor, NULL);
  
  return (DialoG) p;
}
コード例 #25
0
ファイル: taxcs.c プロジェクト: hsptools/hsp-wrap
Boolean tax_addDivision(Int4 div_id, CharPtr div_cde, CharPtr div_txt)
{
    Int2 i;

    if(tax_div == NULL) {
	tax_div= MemNew(sizeof(TaxDivision)*div_alloced);
	if(tax_div == NULL) return FALSE;
	
	for(i= 0; i < div_alloced; i++) {
	    tax_div[i].div_cde[0]= tax_div[i].div_cde[3]= 
		tax_div[i].div_txt[0]= tax_div[i].div_txt[63]= '\0';
	}
    }
    
    if(div_id < 0) return FALSE;

    if(div_id >= div_alloced) {
	TaxDivisionPtr tmp= MemMore(tax_div, sizeof(TaxDivision)*(div_id + 8));

	if(tmp == NULL) return FALSE;
	
	tax_div= tmp;
	for(i= div_alloced; i < div_id + 8; i++) {
	    tax_div[i].div_cde[0]= tax_div[i].div_cde[3]= 
		tax_div[i].div_txt[0]= tax_div[i].div_txt[63]= '\0';
	}
	div_alloced= div_id + 8;
    }

    StringNCpy(tax_div[div_id].div_cde, div_cde, 3);
    StringNCpy(tax_div[div_id].div_txt, div_txt, 63);

    return TRUE;
}
コード例 #26
0
ファイル: copymat.c プロジェクト: hsptools/hsp-wrap
/*allocate memory for the position-specific score matrices
  enough memory is allocated to hold the largest matrix
  the memory is reused for each different matrix*/
static ScoreRow * allocateMatrix(Int4 maxSequenceLength)
{
  ScoreRow *returnMatrix; /*matrix to return*/

  returnMatrix = (ScoreRow *) MemNew(maxSequenceLength * sizeof(ScoreRow));
  return(returnMatrix);
}
コード例 #27
0
ファイル: taxcs.c プロジェクト: hsptools/hsp-wrap
Boolean tax_addGC(Int2 gc_id, CharPtr gc_txt)
{
    Int2 i;

    if(tax_gc == NULL) {
	tax_gc= MemNew(sizeof(TaxGenCode)*gc_alloced);
	if(tax_gc == NULL) return FALSE;
	
	for(i= 0; i < gc_alloced; i++) {
	    tax_gc[i].gc_name[0]= tax_gc[i].gc_name[127]= '\0';	    
	}
    }
    
    if(gc_id < 0) return FALSE;

    if(gc_id >= gc_alloced) {
	TaxGenCodePtr tmp= MemMore(tax_gc, sizeof(TaxGenCode)*(gc_id + 8));

	if(tmp == NULL) return FALSE;
	
	tax_gc= tmp;
	for(i= gc_alloced; i < gc_id + 8; i++) {
	    tax_gc[i].gc_name[0]= tax_gc[i].gc_name[127]= '\0';	    
	}
	gc_alloced= gc_id + 8;
    }

    StringNCpy(tax_gc[gc_id].gc_name, gc_txt, 127);

    return TRUE;
}
コード例 #28
0
ファイル: copymat.c プロジェクト: hsptools/hsp-wrap
/*findTotalLength scans matrixAuxiliaryFile to find the
  total  number of positions among all the position-specific matrices*/
static Int4 findTotalLength(FILE *matrixAuxiliaryFile, Int4 numProfiles,
                            Nlm_FloatHiPtr scalingFactor)
{
    Int4 maxLength; /*maximum length of sequence*/
    Int4 thisLength; /*length of next sequence*/
    Int4 totalLength; /*total length to return*/
    Int4 dbLength; /*length of database*/
    Int4 i; /*loop index*/
    Nlm_FloatHi Kungapped, Hungapped; /*two values to read*/
    Char * underlyingMatrixName; /*name of matrix to read*/
    Int4 gap_open, gap_extend; /*gap costs to skip over in reading*/
    
    underlyingMatrixName = MemNew(MAXLINELEN * sizeof(Char));
    fscanf(matrixAuxiliaryFile,"%s",underlyingMatrixName);
    fscanf(matrixAuxiliaryFile,"%d\n", &gap_open);
    fscanf(matrixAuxiliaryFile,"%d\n", &gap_extend);
    fscanf(matrixAuxiliaryFile, "%le", &Kungapped);
    fscanf(matrixAuxiliaryFile, "%le", &Hungapped);
    fscanf(matrixAuxiliaryFile, "%d", &maxLength);
    fscanf(matrixAuxiliaryFile, "%d", &dbLength);
    fscanf(matrixAuxiliaryFile, "%lf", scalingFactor);
    totalLength = 0;
    for (i = 0; i < numProfiles; i++) {
        fscanf(matrixAuxiliaryFile, "%d", &thisLength);
        fscanf(matrixAuxiliaryFile, "%le", &Kungapped);
        totalLength += thisLength;
    }
    rewind(matrixAuxiliaryFile);
    MemFree(underlyingMatrixName);
    return(totalLength);
}
コード例 #29
0
ファイル: urlquery.c プロジェクト: hsptools/hsp-wrap
NLM_EXTERN AsnIoConnPtr QUERY_AsnIoConnOpen (
  const char* mode,
  CONN conn
)
{
  Int1          type;
  AsnIoConnPtr  aicp;

  if (strcmp(mode, "r") == 0)
    type = (ASNIO_IN | ASNIO_TEXT);
  else if (strcmp(mode, "rb") == 0)
    type = (ASNIO_IN | ASNIO_BIN);
  else if (strcmp(mode, "w") == 0)
    type = (ASNIO_OUT | ASNIO_TEXT);
  else if (strcmp(mode, "wb") == 0)
    type = (ASNIO_OUT | ASNIO_BIN);
  else {
    AsnIoErrorMsg (NULL, 81, mode);
    return NULL;
  }

  aicp = (AsnIoConnPtr) MemNew (sizeof (AsnIoConn));
  aicp->aip = AsnIoNew (type, NULL, (Pointer) aicp, AsnIoConnRead, AsnIoConnWrite);
  aicp->conn = conn;
  return aicp;
}
コード例 #30
0
ファイル: taxutil.c プロジェクト: hsptools/hsp-wrap
static
GeneticCodeListPtr
GeneticCodeListNew(void)
{

	return (GeneticCodeListPtr) MemNew(sizeof(GeneticCodeList));

}