Ver código fonte

cmScore.c : Changed _cmScParseMarkers() to allow multiple recd/play markers on the same line.

master
kevin 10 anos atrás
pai
commit
5c36dfcf9a
1 arquivos alterados com 25 adições e 19 exclusões
  1. 25
    19
      app/cmScore.c

+ 25
- 19
app/cmScore.c Ver arquivo

@@ -613,29 +613,31 @@ cmScRC_t _cmScParseMarkers( cmSc_t* p, unsigned scoreIdx, const cmChar_t* text,
613 613
   if( cmSymTblIsValid(p->stH) == false )
614 614
     return kOkScRC;
615 615
 
616
-  // go to command/id space
617
-  if((ip = cmTextNextWhiteOrEosC(text)) == NULL )
618
-    goto errLabel;
619
-
620
-  // goto label 
621
-  if((ip = cmTextNextNonWhiteC(ip)) == NULL )
622
-    goto errLabel;
623
-
624
-  // goto end of label
625
-  if((ep = cmTextNextWhiteOrEosC(ip)) == NULL )
626
-    goto errLabel;
627
-  else
616
+  for(;(cp = cmTextNextNonWhiteC(cp)) != NULL; cp=ep )
628 617
   {
629
-    unsigned n =  (ep-ip)+1;
630
-    cmChar_t markTextStr[n+1];
631
-    strncpy(markTextStr,ip,n);
618
+    // go to command/id space
619
+    if((ip = cmTextNextWhiteOrEosC(cp)) == NULL )
620
+      goto errLabel;
621
+
622
+    // goto label 
623
+    if((ip = cmTextNextNonWhiteC(ip)) == NULL )
624
+      goto errLabel;
632 625
 
633
-    // for each command code
634
-    // (there may be more than one character)
635
-    for(; *cp && !isspace(*cp); ++cp)
626
+    // goto end of label
627
+    if((ep = cmTextNextWhiteOrEosC(ip)) == NULL )
628
+      goto errLabel;
629
+    else
636 630
     {
637
-      cmMarkScMId_t cmdId = kInvalidScMId;
631
+      unsigned n =  (ep-ip)+1;
632
+      cmChar_t markTextStr[n+1];
633
+      strncpy(markTextStr,ip,n);
634
+      markTextStr[n] = 0;
638 635
 
636
+      // remove any trailing white space
637
+      cmTextTrimEnd(markTextStr);
638
+
639
+      cmMarkScMId_t cmdId = kInvalidScMId;
640
+      
639 641
       switch( *cp )
640 642
       {
641 643
         case 'c': cmdId = kRecdBegScMId; break;
@@ -653,6 +655,8 @@ cmScRC_t _cmScParseMarkers( cmSc_t* p, unsigned scoreIdx, const cmChar_t* text,
653 655
       mp->scoreIdx   = scoreIdx;
654 656
       mp->csvRowIdx  = rowIdx;
655 657
 
658
+      //printf("%i %c '%s'\n",rowIdx,*cp,markTextStr);
659
+
656 660
       // insert the new mark at the end of the list
657 661
       if( p->markList == NULL )
658 662
         p->markList = mp;
@@ -665,7 +669,9 @@ cmScRC_t _cmScParseMarkers( cmSc_t* p, unsigned scoreIdx, const cmChar_t* text,
665 669
         ep->link = mp;
666 670
       }    
667 671
     }
672
+
668 673
   }
674
+
669 675
   return kOkScRC;
670 676
 
671 677
  errLabel:

Carregando…
Cancelar
Salvar