File tree Expand file tree Collapse file tree 4 files changed +21
-18
lines changed
Expand file tree Collapse file tree 4 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -2228,11 +2228,6 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
22282228
22292229 SetFileIdIncrement ();
22302230 int total_insts = 0 , valid_insts = 0 ;
2231- #if defined(__MSVC__) || defined(__BORLAND__)
2232- int exchange_file = -1 ;
2233- #else
2234- __attribute__ ( ( unused ) ) int exchange_file = -1 ;
2235- #endif
22362231
22372232 ReadTokenSeparator ( *in );
22382233 std::string keywd = GetKeyword ( *in, " ; #" , _error );
@@ -2242,11 +2237,9 @@ Severity STEPfile::AppendFile( istream * in, bool useTechCor ) {
22422237
22432238 if ( !strncmp ( const_cast <char *>( keywd.c_str () ), " ISO-10303-21" ,
22442239 strlen ( const_cast <char *>( keywd.c_str () ) ) ) ) {
2245- exchange_file = 1 ;
22462240 SetFileType ( VERSION_CURRENT );
22472241 } else if ( !strncmp ( const_cast <char *>( keywd.c_str () ), " STEP_WORKING_SESSION" ,
22482242 strlen ( const_cast <char *>( keywd.c_str () ) ) ) ) {
2249- exchange_file = 0 ;
22502243 if ( _fileType != WORKING_SESSION ) {
22512244 _error.AppendToUserMsg (
22522245 " Warning: Reading in file as Working Session file.\n " );
Original file line number Diff line number Diff line change @@ -96,6 +96,23 @@ const char * StrToConstant( const char * word, std::string & s ) {
9696 return const_cast <char *>( s.c_str () );
9797}
9898
99+ /* *************************************************************/ /* *
100+ ** \fn StrCmpIns (const char * str1, const char * str2)
101+ ** \returns Comparison result
102+ ** Compares two strings case insensitive (lowercase).
103+ ** Returns < 0 when str1 less then str2
104+ ** == 0 when str1 equals str2
105+ ** > 0 when str1 greater then str2
106+ ******************************************************************/
107+ int StrCmpIns ( const char * str1, const char * str2 ) {
108+ char c1, c2;
109+ while ((c1 = tolower (*str1)) == (c2 = tolower (*str2)) && c1 != ' \0 ' ) {
110+ str1++;
111+ str2++;
112+ }
113+ return c1 - c2;
114+ }
115+
99116/* *************************************************************/ /* *
100117 ** \fn PrettyTmpName (char * oldname)
101118 ** \returns a new capitalized name in a static buffer
Original file line number Diff line number Diff line change 2121#include < string.h>
2222#include < errordesc.h>
2323
24-
25- // StrCmpIns - case-insensitive string compare. Original fct (replaced Sep 2011)
26- // called PrettyTmpName(). Not doing so may affect sort order but that shouldn't hurt
27- #if defined(__MSVC__)
28- #define StrCmpIns (a,b ) _stricmp(a,b)
29- #elif defined(__BORLAND__)
30- #define StrCmpIns (a,b ) stricmp(a,b)
31- #else
32- #define StrCmpIns (a,b ) strcasecmp(a,b)
33- #endif
34-
3524SCL_UTILS_EXPORT char ToLower ( const char c );
3625SCL_UTILS_EXPORT char ToUpper ( const char c );
3726SCL_UTILS_EXPORT char * StrToLower ( const char *, char * );
3827SCL_UTILS_EXPORT const char * StrToLower ( const char * word, std::string & s );
3928SCL_UTILS_EXPORT const char * StrToUpper ( const char * word, std::string & s );
4029SCL_UTILS_EXPORT const char * StrToConstant ( const char * word, std::string & s );
30+ SCL_UTILS_EXPORT int StrCmpIns ( const char *str1, const char *str2 );
4131SCL_UTILS_EXPORT const char * PrettyTmpName ( const char * oldname );
4232SCL_UTILS_EXPORT char * PrettyNewName ( const char * oldname );
4333SCL_UTILS_EXPORT char * EntityClassName ( char * oldname );
Original file line number Diff line number Diff line change @@ -152,6 +152,9 @@ int main( int argc, char * argv[] ) {
152152 sfile.ReadExchangeFile ( flnm );
153153 sfile.Error ().PrintContents ( cout );
154154
155+ if ( sfile.Error ().severity () <= SEVERITY_INCOMPLETE )
156+ exit (1 );
157+
155158 checkSchemaName ( registry, sfile, ignoreErr );
156159
157160 Severity readSev = sfile.Error ().severity (); // otherwise, errors from reading will be wiped out by sfile.WriteExchangeFile()
You can’t perform that action at this time.
0 commit comments