@@ -230,7 +230,7 @@ int inTec_Zone::ParseKeywords( char *buf )
230230 // copy line to buffer and add termination character
231231 memcpy ( data, buf, isize );
232232 data[isize] = ' \0 ' ;
233- #ifdef _DEBUG2_
233+ #ifdef _DEBUG3_
234234 printf (" DATA: %s\n " ,data);
235235#endif
236236
@@ -882,7 +882,7 @@ int inTec_Zone::HandleKeyword_Varlocation( const char *string )
882882 const char *delim;
883883
884884 // first pass is the parentheses and we assume it will not be seen again
885- #ifdef _DEBUG2_
885+ #ifdef _DEBUG3_
886886 printf (" --- Searching for parentheses\n " );
887887#endif
888888 delim = (const char *) " ()" ;
@@ -892,13 +892,13 @@ int inTec_Zone::HandleKeyword_Varlocation( const char *string )
892892 printf (" CANNOT HAVE NULL TOKEN HERE!!! FILL IN ERROR-TRAPPING.\n " );
893893 ierror = 1 ;
894894 }
895- #ifdef _DEBUG2_
895+ #ifdef _DEBUG3_
896896 printf (" --- Token in parentheses --->|%s|<---\n " ,token);
897897#endif
898898
899899 int k;
900900 for ( k=0 ,s=token; ierror==0 ; s=NULL ,++k ) {
901- #ifdef _DEBUG2_
901+ #ifdef _DEBUG3_
902902 printf (" LOOP START: " );
903903 printf (" S -->|%s|<-- \n " ,s);
904904#endif
@@ -936,11 +936,11 @@ int inTec_Zone::HandleKeyword_Varlocation( const char *string )
936936 if ( isign == 1 ) {
937937 int i1=-1 ,i2=-1 ;
938938 is = sscanf ( token, " %d %d" , &i1,&i2);
939- #ifdef _DEBUG_
939+ #ifdef _DEBUG2_
940940 printf (" --- Variable range: %d - %d \n " , i1,i2);
941941#endif
942942 if ( is != 2 ) {
943- #ifdef _DEBUG_
943+ #ifdef _DEBUG2_
944944 printf (" --- Failed parsing range! \n " );
945945#endif
946946 ierror = 2 ;
@@ -961,11 +961,11 @@ int inTec_Zone::HandleKeyword_Varlocation( const char *string )
961961 } else {
962962 int i0=-1 ;
963963 is = sscanf ( token, " %d" , &i0);
964- #ifdef _DEBUG_
964+ #ifdef _DEBUG2_
965965 printf (" --- Variable: %d \n " , i0);
966966#endif
967967 if ( is != 1 ) {
968- #ifdef _DEBUG_
968+ #ifdef _DEBUG2_
969969 printf (" --- Failed parsing variable slot! \n " );
970970#endif
971971 ierror = 2 ;
@@ -982,11 +982,8 @@ int inTec_Zone::HandleKeyword_Varlocation( const char *string )
982982 }
983983 }
984984 }
985-
986-
987-
988- #ifdef _DEBUG2_
989- printf (" Inner cycling... --------------------------------------\n " );
985+ #ifdef _DEBUG3_
986+ printf (" --- Inner cycling... n" );
990987#endif
991988 }
992989 if ( ierror != 0 ) break ;
@@ -1018,37 +1015,41 @@ int inTec_Zone::HandleKeyword_Varlocation( const char *string )
10181015 if ( (*it).second == 99 ) (*it).second = iloc;
10191016 }
10201017
1021- #ifdef _DEBUG2_
1022- printf (" Outer cycling... ----------------------------------------- \ n" );
1018+ #ifdef _DEBUG3_
1019+ printf (" --- Outer cycling... n" );
10231020#endif
10241021 }
10251022
1026- #ifdef _DEBUG2_
1023+ #ifdef _DEBUG3_
10271024 printf (" --- Variable locations (temporary) \n " );
1025+ #endif
10281026 for ( it= itmp_loc.begin (); it != itmp_loc.end (); ++it ) {
1027+ #ifdef _DEBUG3_
10291028 printf (" ==> var. %d location %d \n " , (*it).first , (*it).second );
1029+ #endif
10301030 ivar_loc[ (*it).first ] = (*it).second ;
10311031 }
1032- #endif
10331032
1033+ // drop contents of this array (althought it would have been cleaned)
10341034 itmp_loc.clear ();
1035- }
1036-
1037- if ( ierror != 0 ) printf (" ERROR REPORTED!!!!!!!!\n " );
10381035
1036+ // report on errors trapped
1037+ if ( ierror == 0 ) {
1038+ iret = 0 ;
1039+ } else {
1040+ // provide some output
1041+ }
10391042
1040- #ifdef _DEBUG_
1041- // /// we need to move this out of here...
1042- printf (" --- Variable locations \n " );
1043- std::map< int , int > :: iterator it;
1044- for ( it= ivar_loc.begin (); it != ivar_loc.end (); ++it ) {
1045- printf (" ==> var. %d location %d \n " , (*it).first , (*it).second );
1046- }
1043+ #ifdef _DEBUG2_
1044+ printf (" --- Variable locations \n " );
1045+ for ( it= ivar_loc.begin (); it != ivar_loc.end (); ++it ) {
1046+ printf (" ==> var. %d location %d \n " , (*it).first , (*it).second );
1047+ }
10471048#endif
1048- exit ( 1 );
1049+ }
10491050
10501051#ifdef _DEBUG_
1051- // printf(" --- Problematic VARLOCATION line \n");
1052+ if ( iret != 0 ) printf (" --- Problematic VARLOCATION line \n " );
10521053#endif
10531054
10541055 // drop the buffer
@@ -1057,7 +1058,6 @@ exit(1);
10571058#ifdef _DEBUG_
10581059 printf (" i Exiting HandleKeyword_Varlocation() \n " );
10591060#endif
1060- // printf("EXITING IN CONSISTENCY CHECK...\n");exit(1);//HACK
10611061 return ( iret );
10621062}
10631063
@@ -1287,7 +1287,7 @@ int inTec_Zone::ParseData( char *buf )
12871287#ifdef _DEBUG_
12881288 printf (" i Parsing zone data \n " );
12891289#endif
1290- #ifdef _DEBUG_
1290+ #ifdef _DEBUG2_
12911291 printf (" STRING: --->|%s|<---\n " , buf );
12921292#endif
12931293
@@ -1304,7 +1304,7 @@ int inTec_Zone::ParseData( char *buf )
13041304 for ( i=0 , string = buf; ; ++i, string = NULL ) {
13051305 token = strtok_r ( string, " ," , &sr );
13061306 if ( token == NULL ) break ;
1307- #ifdef _DEBUG_
1307+ #ifdef _DEBUG2_
13081308 printf (" --- token: --->|%s|<--- \n " , token );
13091309#endif
13101310
@@ -1531,18 +1531,18 @@ int inTec_File::ParseLoop()
15311531
15321532int inTec_File::IdentifyComponent ( char *buf )
15331533{
1534- #ifdef _DEBUG2_
1534+ #ifdef _DEBUG_
15351535 printf (" i Inside \" IdentifyComponent()\" \n " );
1536- #ifdef _DEBUG2_
1537- printf (" %s" , buf );
1536+ #ifdef _DEBUG3_
1537+ printf (" BUF: -->| %s" , buf );
15381538#endif
15391539#endif
15401540
15411541 if ( buf == NULL ) return (-1 );
15421542
15431543 size_t isize=0 ;
15441544 while ( buf[isize] != ' \n ' && buf[isize] != ' \0 ' ) ++isize;
1545- #ifdef _DEBUG2_
1545+ #ifdef _DEBUG3_
15461546 printf (" i Size of buffer: %d \n " , (int ) isize);
15471547#endif
15481548
@@ -1636,25 +1636,25 @@ int inTec_File::ParseComponent_HeaderVariables( char *buf )
16361636 // first trap the equal sign
16371637 s1 = data;
16381638 token = strtok_r ( s1, " =" , &sr );
1639- #ifdef _DEBUG2_
1639+ #ifdef _DEBUG3_
16401640 printf (" ---> stok: |%s| \n " ,token);
16411641 printf (" ---> data: |%s| \n " ,data);
16421642#endif
16431643
16441644 // individual variables parsing
16451645 s1 = NULL ;
1646- #ifdef _DEBUG2_
1647- printf (" Inner loop\n " );
1646+ #ifdef _DEBUG4_
1647+ printf (" Inner loop\n " );
16481648#endif
16491649 for (int k=1 ; ; s1 = NULL , ++k) {
16501650 token = strtok_r ( s1, " ," , &sr ); // search delim either ' ' or ','
16511651 if ( token == NULL ) break ;
1652- #ifdef _DEBUG2_
1652+ #ifdef _DEBUG4_
16531653 printf (" ---> starting inner stok: |%s| \n " ,token);
16541654#endif
16551655
16561656 if ( token[0 ] == ' \" ' ) {
1657- #ifdef _DEBUG2_
1657+ #ifdef _DEBUG4_
16581658 int n=1 ,inum=1 ;
16591659 while ( token[n] != ' ' && token[n] != ' \0 ' && token[n] != ' \n ' ) {
16601660 if ( token[n] == ' \" ' ) ++inum;
@@ -1669,22 +1669,22 @@ printf("Inner loop\n");
16691669 if ( sr[-1 ] != ' \" ' ) // only in the
16701670 sr[-1 ] = ' ' ; // reset farthest bound
16711671 s1 = token; // s1 = &(token[1]);
1672- #ifdef _DEBUG2_
1672+ #ifdef _DEBUG4_
16731673 printf (" NEW STRING POINTER AT -->%s<-- \n " , s1 );
16741674#endif
16751675 token = strtok_r ( s1, " \" " , &sr);
16761676 if ( token == NULL ) break ;
16771677// if( token[0] == '\0' ) break; // HACK
16781678 }
1679- #ifdef _DEBUG2_
1679+ #ifdef _DEBUG4_
16801680 printf (" Instance number %d: |%s|\n " , k,token);
16811681#endif
16821682
16831683 // deal with string-token here...
16841684 std::string sdum = token;
16851685 variables.push_back ( sdum );
16861686
1687- #ifdef _DEBUG2_
1687+ #ifdef _DEBUG4_
16881688printf (" \n " ); usleep (100000 );
16891689#endif
16901690 }
@@ -1766,7 +1766,7 @@ int inTec_File::ParseComponent_Zone()
17661766 size_t isize=0 ;
17671767 while ( isize < ibuf_size && buf[isize] != ' \n ' ) ++isize;
17681768 if ( buf[isize] == ' \n ' ) buf[isize] = ' \0 ' ;
1769- #ifdef _DEBUG_
1769+ #ifdef _DEBUG3_
17701770 printf (" STRING (%p, %ld):%s\n " , buf, isize, buf );
17711771#endif
17721772
@@ -1993,6 +1993,11 @@ int inTec_File::ParseComponent_Text()
19931993 // store comment in strings
19941994 buf[ strlen (buf) ] = ' \n ' ;
19951995 strings[ iline ] = buf;
1996+ #ifdef _DEBUG_
1997+ printf (" i Added comment to strings line %ld \n " , iline );
1998+ #endif
1999+ // show the line
2000+ printf (" [%ld] %s" , iline, buf );
19962001 } else {
19972002#ifdef _DEBUG2_
19982003 printf (" --- Found component (at _or_ after Text component) \n " );
0 commit comments