Example #1
0
/****************************************************************************
*   ConvertEmbedQual:
*   -- convert the '/' characters at the start of the embedded-qualifier
*      token to '_'
*                                                                 12-20-93
*****************************************************************************/
NLM_EXTERN void ConvertEmbedQual(CharPtr value)
{
   CharPtr  bptr, ptr, qualname, slash;
   Int2     val;

   if (value != NULL) {

      for (bptr = value; *bptr != '\0';) {

          for (;*bptr != '/' && *bptr != '\0'; bptr++)
              continue;

          if (*bptr == '/') {          
             for (slash = bptr, ++bptr, ptr = bptr; *bptr != '=' && *bptr != ' '
                                                   && *bptr != '\0'; bptr++)
                 continue;

             qualname = TextSave(ptr, bptr-ptr);

             val = GBQualNameValid(qualname);
             if (val >= 0)
                *slash = '_';

             MemFree(qualname);
          }

      } /* for */
   }

} /* ConvertEmbedQual */
Example #2
0
/****************************************************************************
*  ScanEmbedQual:
*  -- retun NULL if no embedded qualifiers found; otherwise, return the
*     embedded qualifier.
*  -- scan embedded valid qualifier
*                                                                  6-29-93
*****************************************************************************/
NLM_EXTERN CharPtr ScanEmbedQual(CharPtr value)
{
   CharPtr  bptr, ptr, qual;
   Int2     val;

   if (value != NULL) {
      for (bptr = value; *bptr != '\0';) {
          for (;*bptr != '/' && *bptr != '\0'; bptr++)
              continue;

          if (*bptr == '/') {          
             for (++bptr, ptr = bptr; *bptr != '=' && *bptr != ' '
                                                   && *bptr != '\0'; bptr++)
                 continue;

             qual = TextSave(ptr, bptr-ptr);

             val = GBQualNameValid(qual);

             if (val >= 0)
                return (qual);

             MemFree(qual);
          }
      } /* for */
   }

   return (NULL);

} /* ScanEmbedQual */
Example #3
0
/*****************************************************************************
*  CkQualMatchToken:
*                                                                6-29-93
*****************************************************************************/
NLM_EXTERN int CkQualMatchToken
(GBQualPtr PNTR head_gbqp, GBQualPtr gbqp, 
   GBQualPtr preq,
   Boolean error_msgs, Boolean perform_corrections, CharPtr array_string[],
   Int2 totalstr)
{
   CharPtr  msg=NULL, bptr, eptr, str;
   int retval = GB_FEAT_ERR_NONE;

	if(gbqp->val == NULL) {
        if (error_msgs){ 
           ErrPostEx(SEV_ERROR, ERR_QUALIFIER_InvalidDataFormat,
             "NULL value for (%s)", gbqp->qual); 
         }
         retval = GB_FEAT_ERR_DROP;
         if (perform_corrections){
            DeleteGBQualFromList(head_gbqp, gbqp, preq);
         }
   		return retval;
	} 
   str = gbqp->val;

   for (bptr = str; *str != '\0' && *str != ' '; str++)
       continue;
   eptr = str;
   
   while (*str != '\0' && *str == ' ')
       str++;

   if (*str == '\0') {
      msg = TextSave(bptr, eptr-bptr);

      if (MatchArrayStringIcase(array_string, totalstr, msg) == -1) {
        if (error_msgs){ 
           ErrPostEx(SEV_ERROR, ERR_QUALIFIER_InvalidDataFormat,
             "Value not in list of legal values /%s=%s",
            gbqp->qual,gbqp->val); 
         }
         retval = GB_FEAT_ERR_DROP;
         if (perform_corrections){
            DeleteGBQualFromList(head_gbqp, gbqp, preq);
         }
  	  }
   } else {
         if (error_msgs){ 
           ErrPostEx(SEV_ERROR, ERR_QUALIFIER_Too_many_tokens,
             "/%s=%s", gbqp->qual,gbqp->val); 
         }
         retval = GB_FEAT_ERR_DROP;
         if (perform_corrections){
            DeleteGBQualFromList(head_gbqp, gbqp, preq);
         }
   }

   MemFree(msg);
   return retval;
 
} /* CkQualMatchToken */
Example #4
0
/***************************************************************************
*  CkQualSeqaa:
*  -- format       (seq:"codon-sequence", aa:amino_acid)
*  -- example      /codon=(seq:"ttt",aa:Leu)
*                  /codon=(seq: "ttt", aa: Leu )
*                                                                  6-29-93
***************************************************************************/
NLM_EXTERN int CkQualSeqaa (GBQualPtr PNTR head_gbqp, GBQualPtr gbqp, 
   GBQualPtr preq,
   Boolean error_msgs, Boolean perform_corrections)
{
   CharPtr  eptr, str, aa;
   int retval = GB_FEAT_ERR_NONE;

   str = gbqp->val;

   if (StringNICmp(str, "(seq:", 5) == 0) {
      str += 5;

      while (*str == ' ')
          ++str;

      if ((eptr = StringChr(str, ',')) != NULL) { 
         while (str != eptr)
             str++;

         while (*str != '\0' && (*str == ',' || *str == ' '))
             str++;

         if (StringNICmp(str, "aa:", 3) == 0) {
            str += 3;

            while (*str == ' ')
                ++str;

            if ((eptr = StringChr(str, ')')) != NULL) {
               aa = TextSave(str, eptr-str);
               
                 retval = CkQualPosSeqaa(head_gbqp,  gbqp, preq,
                    error_msgs, perform_corrections,  aa, eptr);

             }
           } /* if, aa: */ else{
            if (error_msgs){ 
               ErrPostEx(SEV_ERROR, ERR_QUALIFIER_AA,
                 "Missing aa: /%s=%s",gbqp->qual,gbqp->val); 
             }
             retval = GB_FEAT_ERR_DROP;
             if (perform_corrections){
                DeleteGBQualFromList(head_gbqp, gbqp, preq);
             }
            
         }
      }else{
         if (error_msgs){ 
            ErrPostEx(SEV_ERROR, ERR_QUALIFIER_SeqPosComma,
               "Missing \',\' /%s=%s",gbqp->qual,gbqp->val); 
   /* ) match */             
         }
         retval = GB_FEAT_ERR_DROP;
        if (perform_corrections){
             DeleteGBQualFromList(head_gbqp, gbqp, preq);
         }
      }
   } /* if, (seq: */ else {


        if (error_msgs){ 
           ErrPostEx(SEV_ERROR, ERR_QUALIFIER_Seq,
              "Missing (seq: /%s=%s",gbqp->qual,gbqp->val); 
/* ) match */             
        }
        retval = GB_FEAT_ERR_DROP;
       if (perform_corrections){
            DeleteGBQualFromList(head_gbqp, gbqp, preq);
        }
      }
  
      return retval;

} /* CkQualSeqaa */
Example #5
0
/***************************************************************************
*  CkQualText:
*  -- return error severity
*  -- also check if embedded qualifier
*  -- format      "text"
*  if called from /note, ="" will cause qualifier to be dropped.
*  all others no error, all other, if no qualifier, will add "" value                                                        
****************************************************************************/
NLM_EXTERN int CkQualText (GBQualPtr PNTR head_gbqp,  GBQualPtr gbqp, 
   GBQualPtr preq,
   Boolean PNTR has_embedded, Boolean from_note, Boolean error_msgs, 
   Boolean perform_corrections)
{
   CharPtr  value=NULL, bptr, eptr, str;
   int retval = GB_FEAT_ERR_NONE;

   if (has_embedded != NULL){
     *has_embedded = FALSE;
   }
   if (gbqp->val == NULL) {
       if (from_note){
               if (error_msgs){ 
                ErrPostEx(SEV_ERROR, ERR_QUALIFIER_EmptyNote,
                   "/note with no text "); 
               }
               retval = GB_FEAT_ERR_DROP;
               if (perform_corrections){
                  DeleteGBQualFromList(head_gbqp, gbqp, preq);
               }
               return retval;
       } else {
           retval = GB_FEAT_ERR_SILENT;
           if (perform_corrections){
               gbqp ->val = StringSave("\"\"");  /* yup, a "" string is legal */
           } else {
           		return retval;
           }
       }                        
   }
   str = gbqp->val;
   while (*str != '\0' && (*str == ' ' || *str == '\"')){
    /* open double quote */
       str++; 
       if (*(str-1) == '\"'){
         break;  /* so does not continue through a "" string */
       }
    }
   /* find first close double quote */
   for (bptr = str; *str != '\0' && *str != '\"'; str++)
       continue;
   eptr = str;
   
   while (*str != '\0' && (*str == ' ' || *str == '\"'))
       str++;

   if (*str != '\0'){
/*   extra stuff is already rm in ParseQualifiers(). Tatiana*/
/* extra stuff, if perform corrections, remove it */
/* ERROR  here  sets retval*/
   }

      value = TextSave(bptr, eptr-bptr);
/* Some check must be done for illegal characters in gbpq->val
      for (s = value; *s != '\0'; s++) {
      	if (!IS_WHITESP(*s) && !IS_ALPHANUM(*s) && *s != '\"') {
            if (error_msgs){ 
                ErrPostEx(SEV_WARNING, ERR_QUALIFIER_IllegalCharacter,
                   "illegal char [%c] used in qualifier %s", s, gbqp ->qual);
             }      
             return (retval > GB_FEAT_ERR_REPAIRABLE) ? retval : 
            								GB_FEAT_ERR_REPAIRABLE;
      	}
      }
*/
 /* only finds first embedded qualifier */
      if (value != NULL && ((bptr = ScanEmbedQual(value)) != NULL)) {
 
         if (has_embedded != NULL) {
            *has_embedded = TRUE;
         }
         MemFree(value);
         MemFree(bptr);
         if (from_note){
            if (error_msgs){ 
                ErrPostEx(SEV_WARNING, ERR_QUALIFIER_NoteEmbeddedQual,
                   "/note with embedded qualifiers %s", gbqp ->val);
            }
            return (retval > GB_FEAT_ERR_REPAIRABLE) ? retval : 
            								GB_FEAT_ERR_REPAIRABLE;
         }else{
            if (error_msgs){ 
                ErrPostEx(SEV_WARNING, ERR_QUALIFIER_EmbeddedQual,
                   "/%s with embedded qualifiers %s", 
                   gbqp -> qual, gbqp ->val);
            }
            return retval;
         }

/*  This needs to be discussed some!, not sure -Karl 1/28/94 */
      }

      MemFree(value);

      return retval;
} /* CkQualText */
Example #6
0
/***************************************************************************
*  CkQualPosaa:
*  
*  -- format       (pos:base_range, aa:amino_acid)
*  -- example      /anticodon=(pos:34..36,aa:Phe)
*                  /anticodon=(pos: 34..36, aa: Phe)
*                                                                 10-12-93
****************************************************************************/
NLM_EXTERN int CkQualPosaa(GBQualPtr PNTR head_gbqp, GBQualPtr gbqp, 
   GBQualPtr preq,
   Boolean error_msgs, Boolean perform_corrections)
{
   CharPtr  eptr, str, aa = NULL;
   int retval = GB_FEAT_ERR_NONE;

   str = gbqp->val;

   if (StringNICmp(str, "(pos:", 5) == 0) {
      str += 5;

      while (*str == ' ')
          ++str;

/*---I expect that we maight need to allow blanks here, 
            but not now... -Karl 1/28/94 */
      if ((eptr = StringChr(str, ',')) != NULL) { 
         while (str != eptr  && (IS_DIGIT(*str) || *str == '.'))
             str++;

         if (str == eptr) {
            while (*str != '\0' && (*str == ',' || *str == ' '))
                str++;

            if (StringNICmp(str, "aa:", 3) == 0) {
               str += 3;

               while (*str == ' ')
                   ++str;

               if ((eptr = StringChr(str, ')')) != NULL) {
                  aa = TextSave(str, eptr-str);
                  
                  
                 retval = CkQualPosSeqaa(head_gbqp,  gbqp, preq,
                    error_msgs, perform_corrections,  aa, eptr);
               }
            } /* if, aa: */ else{
               if (error_msgs){ 
                ErrPostEx(SEV_ERROR, ERR_QUALIFIER_AA,
                   "Missing aa: /%s=%s",gbqp->qual,gbqp->val); 
               }
               retval = GB_FEAT_ERR_DROP;
               if (perform_corrections){
                  DeleteGBQualFromList(head_gbqp, gbqp, preq);
               }
            }
         }
      }else{
         if (error_msgs){ 
            ErrPostEx(SEV_ERROR, ERR_QUALIFIER_SeqPosComma,
               "Missing \',\' /%s=%s",gbqp->qual,gbqp->val); 
   /* ) match */             
         }
         retval = GB_FEAT_ERR_DROP;
        if (perform_corrections){
             DeleteGBQualFromList(head_gbqp, gbqp, preq);
         }
      }
   } /* if, (pos: */  else{
      if (error_msgs){ 
         ErrPostEx(SEV_ERROR, ERR_QUALIFIER_Pos,
            "Missing (pos: /%s=%s",gbqp->qual,gbqp->val); 
/* ) match */             
      }
      retval = GB_FEAT_ERR_DROP;
     if (perform_corrections){
          DeleteGBQualFromList(head_gbqp, gbqp, preq);
      }
   }
                        
      return retval;

} /* CkQualPosaa */
Example #7
0
/***************************************************************************
*  SplitMultiValQual:
*
*     
****************************************************************************/
NLM_EXTERN int SplitMultiValQual(GBQualPtr PNTR gbqp, 
     Boolean error_msgs, Boolean perform_corrections)
{
   Int2        val/*, len -- UNUSED */;
   GBQualPtr   next_q, curq, preq = NULL, first_q, tmp;
   int retval = GB_FEAT_ERR_NONE;
   CharPtr	bptr, ptr, buf;
   
   for (first_q = curq = *gbqp; curq != NULL; curq = next_q) {
        next_q = curq -> next;  /* in case deleted */

       val = GBQualSplit(curq->qual);
/*       len = StringLen(curq->qual); -- NO EFFECT */

       if (val == -1) {
       		preq = curq;
       		continue;
       }
       bptr = curq->val;
       if (bptr == NULL) {
       		preq = curq;
       		continue;
       }
       if (*bptr != '(') {
       		preq = curq;
       		continue;
       }
       if (*(bptr+StringLen(bptr)-1) != ')') {
       		preq = curq;
       		continue;
       }
 	   *(bptr+StringLen(bptr)-1) = '\0';
      if ((ptr = StringChr(bptr, ',')) == NULL) {
      		StringCpy(bptr, bptr+1);
       		preq = curq;
       		continue;
        }
      			
		ErrPostEx(SEV_WARNING, ERR_QUALIFIER_MultiValue,
		   "Splited qualifier %s", curq->qual); 
		buf = bptr;
		bptr++;
		curq->val = TextSave(bptr, ptr-bptr);
		bptr = ptr + 1;
		curq->next = NULL;
		while ((ptr = StringChr(bptr, ',')) != NULL) {
			tmp = GBQualNew();
			tmp->qual = StringSave(curq->qual);
			tmp->val = TextSave(bptr, ptr-bptr);
			curq = tie_qual(curq, tmp);
			bptr = ptr + 1;
		} 
		tmp = GBQualNew();
		tmp->qual = StringSave(curq->qual);
		tmp->val = StringSave(bptr);
		curq = tie_qual(curq, tmp);
		tmp->next = next_q;
		curq = tmp;
		MemFree(buf);
      
       if (preq){
  /*---- we have retained a qualifier, previously ----*/     
          if (preq -> next != next_q){
   /*-- did not delete curq ----*/  
              preq = curq;     
          }
       }else {
    /* ---- no qualifier previously retained, is there a new head pointer? */
          if (first_q == *gbqp){
      /* ---- we have kept our first qualifier  */
             preq = curq;    
          }else{
      /*--- we deleted the head of the queue, record current first qualifier */
             first_q = *gbqp;     
          }   
       }
      if (*gbqp == NULL){
          break;  /* was one, is gone */
       }
   }

   return retval;

} /* SplitMultiValQual */  
Example #8
0
/***************************************************************************
*  CkQualTokenType:
*  -- format   single token
*  -- example  ParFlat_Stoken_type        /label=Albl_exonl  /mod_base=m5c
*              ParFlat_BracketInt_type    /citation=[3] or /citation= ([1],[3])
*              ParFlat_Integer_type           /transl_table=4
*				ParFlat_Number_type			/number=4b
*  -- not implemented yet, treat as ParFlat_Stoken_type:
*     -- feature_label or base_range              
*                 /rpt_unit=Alu_rpt1   /rpt_unit=202..245
*     -- Accession-number:feature-name or
*                            Database_name:Acc_number:feature_label
*        /usedin=X10087:proteinx
*                                                                 10-12-93
***************************************************************************/
NLM_EXTERN int CkQualTokenType (GBQualPtr PNTR head_gbqp,  GBQualPtr gbqp, 
   GBQualPtr preq,
   Boolean error_msgs, Boolean perform_corrections, Uint1 type)
{
   CharPtr  token = NULL, bptr, eptr, str;
   Boolean token_there = FALSE;
   int retval = GB_FEAT_ERR_NONE;

   str = gbqp->val;

   if (str != NULL)
    if (*str != '\0'){
			token_there = TRUE;
    }
   if (! token_there) {
     if (error_msgs){ 
        ErrPostEx(SEV_ERROR, ERR_QUALIFIER_InvalidDataFormat,
          "Missing value /%s=...",gbqp->qual); 
      }
      retval = GB_FEAT_ERR_DROP;
      if (perform_corrections){
         DeleteGBQualFromList(head_gbqp, gbqp, preq);
      }
   }else{
/*  token there */
   for (bptr = str; *str != '\0' && *str != ' '; str++)
       continue;
   eptr = str;
   
   while (*str != '\0' && *str == ' ')
       str++;

   if (*str == '\0') {
/*------single token found ----*/
      token = TextSave(bptr, eptr-bptr);

      bptr = token;

      switch (type) {
         case ParFlat_BracketInt_type:
/*-------this can be made to be much more rigorous --Karl ---*/
			  str = CkBracketType(token);			
               break;
         case ParFlat_Integer_type:
              for (str = token; *str != '\0' && IS_DIGIT(*str); str++)
              		continue;
              if (*str == '\0') {
              	str = NULL;
              }
              break;
         case ParFlat_Stoken_type:
         		str = CkLabelType(token);
               break;
         case ParFlat_Number_type:
         		str = CkNumberType(token);
               break;
        default:
              str = NULL;
              break;
      }

      if (str != NULL) {
         switch (type) {
            case ParFlat_BracketInt_type:
                         bptr = "Invalid [integer] format"; 
                         break;
            case ParFlat_Integer_type:
                         bptr = "Not an integer number";
                         break;
            case ParFlat_Stoken_type:
                         bptr = "Invalid format";
                         break;
/*-- logically can not happen, as coded now -Karl  1/31/94 --*/
            default:     bptr = "Bad qualifier value";
                         break;
         }
        if (error_msgs){ 
           ErrPostEx(SEV_ERROR, ERR_QUALIFIER_InvalidDataFormat,
             "%s=%s, at %s", gbqp->qual,gbqp->val, str); 
         }
         retval = GB_FEAT_ERR_DROP;
         if (perform_corrections){
            DeleteGBQualFromList(head_gbqp, gbqp, preq);
         }
      }
   } else{
/*-- more than a single token found ---*/
     if (error_msgs){ 
        ErrPostEx(SEV_ERROR, ERR_QUALIFIER_Xtratext,
          "extra text found /%s=%s, at %s",gbqp->qual,gbqp->val, str); 
      }
      retval = GB_FEAT_ERR_DROP;
      if (perform_corrections){
         DeleteGBQualFromList(head_gbqp, gbqp, preq);
      }
   }
 } /* token there */

      MemFree(token);
      return retval;

} /* CkQualTokenType */
Example #9
0
void menu()
{	
	exit_menu = 0;
	uint8_t menu,regreso,opcion=0,continue_menu=0;
	

		while(exit_menu ==0)
		{
			regreso =0;
			clrscr();
			gotoxy(0x01,0x01);
			UART0_putsf(MenuOp);
			menu = UART0_getch();
			switch (menu)
			{
				case 'a': /*Mensaje de marquesina */
				{
					clrscr();
					UART0_putsf(SubMenuOp1);
					gotoxy(6,10);
					TextSave(TEXT_ADDRESS);

				    exit_menu =0;
					break;
				}
				
				case 'b': /*Ajuste de Reloj*/
				{ 
					clrscr();
					gotoxy(0x01,0x01);
					UART0_putsf(SubMenuOp2);
					opcion = 0;
					while(opcion == 0)
					{
						if( Timer2_Flag ())
					  	{
					  		gotoxy(0x06,0x06);
							Clock_Update();
					  		Clock_Display();
					  	}
					  	
					  	if(UART0_kbhit() == 0x0D)
						{
							clrscr();
							gotoxy(0x01,0x01);
							UART0_putsf(SubMenuOp2a);
							gotoxy(0x06,0x06);
							config_clock();
							clrscr();
							gotoxy(0x01,0x01);
							UART0_putsf(SubMenuOp2);
							opcion = 0;
						}

						if(UART0_kbhit() == 0x1B)
						{
							opcion = 1;
						}
					} /*   ajuste(hr:min) (mostrar reloj actual) */
				  
					exit_menu =0;
					break;
				}

				case 'c':
				{	
					exit_menu =1;
					clrscr();
					break;/*Salir */
				}

				default:
				{
					exit_menu =0;
					break;
				}
			}

	}
	if(continue_menu == 1)
	{
		clrscr();
	}
}