43 #if defined __cplusplus
76 if( channelID != NULL ) {
89 for( spectralID = channelID->
spectralIDs; spectralID != NULL; spectralID = next ) {
90 next = spectralID->
next;
101 return( _tpi_channelID_parse2( smr, str, str, 0, EOP ) );
113 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Empty channel string to parse for '%s'", origStr );
121 priorSpectral->
next = spectralID;
122 priorSpectral = spectralID;
124 if( **EOP == 0 )
break;
125 if( isDecayChannel && ( **EOP ==
')' ) )
break;
127 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Missing '+' (or maybe ')') in channelID at '%s' of '%s'", *EOP, origStr );
148 char *sans[] = { (
char*)
"revision", NULL };
159 for( spectralID = channelID->
spectralIDs; spectralID != NULL; spectralID = spectralID->
next ) {
161 if( spectralID->
next != NULL ) {
162 if( (
gString_addTo( smr, gStr,
" + " ) ) != 0 )
return( 1 );
177 return( spectralID );
193 if( spectralID != NULL ) {
206 if( spectralID->
name != NULL ) free( spectralID->
name );
207 for( qualifier = spectralID->
qualifiers; qualifier != NULL; qualifier = next ) {
208 next = qualifier->
next;
220 return( _tpi_spectralID_parse2( smr, str, str, EOP ) );
227 int breakup = 0, i1, i2,
m;
237 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Empty spectralID string to parse for '%s'", origStr );
245 if( !isalpha( **EOP ) ) {
246 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Invalid spectralID name '%s' in '%s'", *EOP, origStr );
249 for( s = *EOP, i1 = 0; ( isalnum( **EOP ) ) || ( **EOP ==
'_' ); (*EOP)++ ) i1++;
257 while( **EOP == bOrC ) {
261 if( !isalpha( **EOP ) ) {
262 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Invalid qualifier name '%s' in '%s'", *EOP, origStr );
266 for( s = *EOP, i1 = 0; ( isalnum( **EOP ) ) || ( **EOP ==
'_' ); (*EOP)++ ) i1++;
270 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Missing ':' in qualifier defintion at '%s' in '%s'", *EOP, origStr );
277 if( ( **EOP !=
'"' ) && ( **EOP !=
'\'' ) ) {
278 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Missing start quote in qualifier defintion at '%s' in '%s'", *EOP, origStr );
284 for( q = *EOP, i2 = 0; ( **EOP !=
c ) && ( **EOP != 0 ); (*EOP)++ ) i2++;
286 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Missing end quote in qualifier defintion at '%s' in '%s'", *EOP, origStr );
297 qualifier->
next = NULL;
298 qualifier->
name = (
char *) &(qualifier[1]);
299 qualifier->
value = &(qualifier->
name[i1+1]);
300 strncpy( qualifier->
name, s, i1 );
301 qualifier->
name[i1] = 0;
302 strncpy( qualifier->
value, q, i2 );
303 qualifier->
value[i2] = 0;
305 if( strcmp( qualifier->
name,
"revision" ) == 0 ) {
307 else if( strcmp( qualifier->
name,
"multiplicity" ) == 0 ) {
309 else if( strcmp( qualifier->
name,
"level" ) == 0 ) {
312 priorQualifier->
next = qualifier;
313 priorQualifier = qualifier;
316 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Missing ']' for qualifier at '%s' in '%s'", *EOP, origStr );
325 if( spectralID->
levelStr != NULL ) {
326 d = strtod( spectralID->
levelStr, &e );
327 if( ( *e == 0 ) && ( e != spectralID->
levelStr ) ) spectralID->
level =
d;
332 if( ( **EOP !=
'-' ) || ( (*EOP)[1] !=
'>' ) ) {
333 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Missing '->' for breakup at '%s' in '%s'", *EOP, origStr );
338 if( (spectralID->
decayChannel = _tpi_channelID_parse2( smr, *EOP, origStr, breakup, EOP )) == NULL )
342 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Missing ')' for breakup at '%s' in '%s'", *EOP, origStr );
348 return( spectralID );
363 char *sans[] = { (
char*)
"revision", NULL };
375 char **san, *sSan[] = { NULL };
377 if( sans == NULL ) sans = sSan;
381 for( qualifier = spectralID->
qualifiers, i = 0; qualifier != NULL; qualifier = qualifier->
next ) i++;
382 for( qualifier = spectralID->
qualifiers; qualifier != NULL; qualifier = qualifier->
next ) {
383 for( san = (
char **) sans; *san != NULL; san++ ) {
384 if( strcmp( *san, qualifier->
name ) == 0 ) {
392 for( qualifier = spectralID->
qualifiers; qualifier != NULL; qualifier = qualifier->
next ) {
393 for( san = (
char **) sans; *san != NULL; san++ )
if( strcmp( *san, qualifier->
name ) == 0 )
break;
394 if( *san != NULL )
continue;
409 if( (
gString_addTo( smr, gStr,
" -> " ) ) != 0 )
return( 1 );
423 for( s = str; ( *s != 0 ) && isspace( *s ); s++ ) ;
434 if( ( s = (
char*)
xData_malloc2( smr, n + 1, 0,
"s" ) ) == NULL )
return( NULL );
435 strncpy( s, str, n );
440 #if defined __cplusplus