1010* and is not subject to copyright.
1111*/
1212
13- /* $Id: Str.cc,v 3.0.1.3 1997/11/05 22:33:52 sauderd DP3.1 $ */
14-
1513#include < Str.h>
1614
1715/* *****************************************************************
2422 ** Status: complete
2523 ******************************************************************/
2624
27- char
28- ToLower ( const char c ) {
25+ char ToLower ( const char c ) {
2926 if ( isupper ( c ) ) {
3027 return ( tolower ( c ) );
3128 } else {
@@ -34,20 +31,16 @@ ToLower( const char c ) {
3431
3532}
3633
37- char
38- ToUpper ( const char c ) {
34+ char ToUpper ( const char c ) {
3935 if ( islower ( c ) ) {
4036 return ( toupper ( c ) );
4137 } else {
4238 return ( c );
4339 }
4440}
4541
46- char *
47- StrToLower ( const char * strOld, char * strNew )
48- /*
49- * Place in strNew a lowercase version of strOld.
50- */
42+ // Place in strNew a lowercase version of strOld.
43+ char * StrToLower ( const char * strOld, char * strNew )
5144{
5245 int i = 0 ;
5346
@@ -59,11 +52,9 @@ StrToLower( const char * strOld, char * strNew )
5952 return strNew;
6053}
6154
62- const char *
63- StrToLower ( const char * word, std::string & s ) {
55+ const char * StrToLower ( const char * word, std::string & s ) {
6456 char newword [BUFSIZ];
6557 int i = 0 ;
66- // char ToLower (char c);
6758
6859 while ( word [i] != ' \0 ' ) {
6960 newword [i] = ToLower ( word [i] );
@@ -74,27 +65,22 @@ StrToLower( const char * word, std::string & s ) {
7465 return const_cast <char *>( s.c_str () );
7566}
7667
77- const char *
78- StrToUpper ( const char * word, std::string & s ) {
68+ const char * StrToUpper ( const char * word, std::string & s ) {
7969 char newword [BUFSIZ];
8070 int i = 0 ;
81- // char ToUpper (char c);
8271
8372 while ( word [i] != ' \0 ' ) {
8473 newword [i] = ToUpper ( word [i] );
8574 ++i;
86-
8775 }
8876 newword [i] = ' \0 ' ;
8977 s = newword;
9078 return const_cast <char *>( s.c_str () );
9179}
9280
93- const char *
94- StrToConstant ( const char * word, std::string & s ) {
81+ const char * StrToConstant ( const char * word, std::string & s ) {
9582 char newword [BUFSIZ];
9683 int i = 0 ;
97- // char ToUpper (char c);
9884
9985 while ( word [i] != ' \0 ' ) {
10086 if ( word [i] == ' /' || word [i] == ' .' ) {
@@ -103,7 +89,6 @@ StrToConstant( const char * word, std::string & s ) {
10389 newword [i] = ToUpper ( word [i] );
10490 }
10591 ++i;
106-
10792 }
10893 newword [i] = ' \0 ' ;
10994 s = newword;
@@ -119,8 +104,7 @@ StrToConstant( const char * word, std::string & s ) {
119104 PrettyTmpName returns new name in a static buffer
120105 ** Status: OK 7-Oct-1992 kcm
121106 ******************************************************************/
122- const char *
123- PrettyTmpName ( const char * oldname ) {
107+ const char * PrettyTmpName ( const char * oldname ) {
124108 int i = 0 ;
125109 static char newname [BUFSIZ];
126110 newname [0 ] = ' \0 ' ;
@@ -134,38 +118,18 @@ PrettyTmpName( const char * oldname ) {
134118 ++i;
135119 }
136120 }
137-
138121 newname [0 ] = ToUpper ( oldname [0 ] );
139122 newname [i] = ' \0 ' ;
140123 return newname;
141124}
142125
143- char *
144- PrettyNewName ( const char * oldname ) {
126+ char * PrettyNewName ( const char * oldname ) {
145127
146128 char * name = new char [strlen ( oldname ) + 1 ];
147129 strcpy ( name, PrettyTmpName ( oldname ) );
148130 return name;
149131}
150132
151- int
152- StrCmpIns ( const char * strA, const char * strB )
153- /*
154- * An insensitive string compare function. Used most often to compare
155- * names of objects where case is not known and not significant.
156- *
157- * NOTE - cygnus does not define strcmpi/stricmp. I'm sure there's a nifty
158- * way to add preprocessor commands to check if it exists, and if so to
159- * use it, but I didn't bother.
160- */
161- {
162- char str1[BUFSIZ], str2[BUFSIZ];
163-
164- strncpy ( str1, PrettyTmpName ( strA ), BUFSIZ - 1 );
165- strncpy ( str2, PrettyTmpName ( strB ), BUFSIZ - 1 );
166- return ( strcmp ( str1, str2 ) );
167- }
168-
169133// This function is used to check an input stream following a read. It writes
170134// error messages in the 'ErrorDescriptor &err' argument as appropriate.
171135// 'const char *tokenList' argument contains a string made up of delimiters
0 commit comments