[sword-cvs] sword/src/keys versekey.cpp,1.52,1.53

sword@www.crosswire.org sword@www.crosswire.org
Mon, 26 May 2003 01:36:33 -0700


Update of /usr/local/cvsroot/sword/src/keys
In directory www:/tmp/cvs-serv17071/src/keys

Modified Files:
	versekey.cpp 
Log Message:
	Improved verse reference parsing to include proper
		parsing of osisRef attributes and other
		misc. anomalies.
	Returned canon.h back to previous state to
		avoid locale key mismatches



Index: versekey.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/keys/versekey.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** versekey.cpp	26 May 2003 04:32:45 -0000	1.52
--- versekey.cpp	26 May 2003 08:36:31 -0000	1.53
***************
*** 453,462 ****
  
                                  for (loop = strlen(book) - 1; loop+1; loop--) {
!                                 if (book[loop] == ' ') {
!                                         if (isroman(&book[loop+1])) {
!                                                 if (verse == -1) {
!                                                         verse = chap;
! 				        		chap = from_rom(&book[loop+1]);
! 					        	book[loop] = 0;
  					       	        }
                                                  }
--- 453,462 ----
  
                                  for (loop = strlen(book) - 1; loop+1; loop--) {
! 					if (book[loop] == ' ') {
! 						if (isroman(&book[loop+1])) {
! 							if (verse == -1) {
! 								verse = chap;
! 								chap = from_rom(&book[loop+1]);
! 								book[loop] = 0;
  					       	        }
                                                  }
***************
*** 472,477 ****
                                          }
                                  }
! 
! 		        	bookno = getBookAbbrev(book);
  			}
  			if (((bookno > -1) || (!*book)) && ((*book) || (chap >= 0) || (verse >= 0))) {
--- 472,479 ----
                                          }
                                  }
!                                 if ((!stricmp(book, "ch")) || (!stricmp(book, "chap"))) {	// Verse abbrev
! 					strcpy(book, VerseKey(tmpListKey).getBookName());
!                                 }
! 				bookno = getBookAbbrev(book);
  			}
  			if (((bookno > -1) || (!*book)) && ((*book) || (chap >= 0) || (verse >= 0))) {
***************
*** 565,568 ****
--- 567,574 ----
  		case 10:	// ignore these
  		case 13: 
+ 		case '[': 
+ 		case ']': 
+ 		case '(': 
+ 		case ')': 
  			break;
  		case '.':
***************
*** 570,573 ****
--- 576,586 ----
  				if (!isdigit(*(buf-1)))
  					break;
+ 
+ 			number[tonumber] = 0;
+ 			tonumber = 0;
+ 			if (*number)
+ 				chap = atoi(number);
+ 			*number = 0;
+ 			break;
  			
  		default:
***************
*** 640,643 ****
--- 653,659 ----
  		}
  			
+ 		if ((!stricmp(book, "ch")) || (!stricmp(book, "chap"))) {	// Verse abbrev
+ 			strcpy(book, VerseKey(tmpListKey).getBookName());
+ 		}
  		bookno = getBookAbbrev(book);
  	}
***************
*** 1461,1465 ****
  	static char *osisotbooks[] = {
  			"Gen","Exod","Lev","Num","Deut","Josh","Judg","Ruth","1Sam","2Sam",
! 			"1Kgs","2Kgs","1Chr","2Chr","Ezra","Neh","Esth","Job","Pss",
  			"Prov",		// added this.  Was not in OSIS spec
  			"Eccl",
--- 1477,1481 ----
  	static char *osisotbooks[] = {
  			"Gen","Exod","Lev","Num","Deut","Josh","Judg","Ruth","1Sam","2Sam",
! 			"1Kgs","2Kgs","1Chr","2Chr","Ezra","Neh","Esth","Job","Ps",
  			"Prov",		// added this.  Was not in OSIS spec
  			"Eccl",