Changeset 847ebdd in git for factory/ftest/ftest_io.cc
- Timestamp:
- Mar 31, 1998, 12:36:02 PM (26 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
- Children:
- 751138e12946462278cccd137b6f8ae5f426a649
- Parents:
- bc82d60fa171675a0c23a3e2051318500187aa39
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/ftest/ftest_io.cc
rbc82d6 r847ebdd 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: ftest_io.cc,v 1.1 1 1998-03-11 16:10:54schmidt Exp $ */2 /* $Id: ftest_io.cc,v 1.12 1998-03-31 10:36:02 schmidt Exp $ */ 3 3 4 4 //{{{ docu … … 34 34 const char * stringF = canFormSpec; 35 35 stringF = ftestSkipBlancs( stringF ); 36 if ( *stringF == '<' ) { 37 CanonicalForm f; 38 39 stringF++; 40 if ( *stringF == '-' ) { 41 // read canonical form from stdin 36 37 // check for a single minus 38 if ( stringF[0] == '-' ) { 39 const char * tokenCursor = ftestSkipBlancs( stringF+1 ); 40 41 if ( ! *tokenCursor ) { 42 CanonicalForm f; 42 43 cin >> f; 43 } else 44 return f; 45 } 46 } 47 48 // get string to read canonical form from 49 if ( *stringF == '$' ) { 50 const char * tokenCursor = ftestSkipBlancs( stringF+1 ); 51 // read canonical form from environment 52 stringF = getenv( tokenCursor ); 53 if ( ! stringF ) 44 54 ftestError( CanFormSpecError, 45 "not a valid canonical form specification `<%s'\n", 46 stringF ); 47 return f; 48 } else { 49 // get string to read canonical form from 50 if ( *stringF == '$' ) { 51 const char * tokenCursor = ftestSkipBlancs( stringF+1 ); 52 // read canonical form from environment 53 stringF = getenv( tokenCursor ); 54 if ( ! stringF ) 55 ftestError( CanFormSpecError, 56 "no environment variable `$%s' set\n", 57 tokenCursor ); 55 "no environment variable `$%s' set\n", 56 tokenCursor ); 57 } 58 59 // create terminated CanonicalForm 60 int i = strlen( stringF ); 61 char * terminatedStringF = new char[i+2]; 62 char * stringCursor = terminatedStringF; 63 while ( *stringF ) { 64 switch ( *stringF ) { 65 case '.': *stringCursor = '*'; break; 66 case '{': *stringCursor = '('; break; 67 case '}': *stringCursor = ')'; break; 68 default: *stringCursor = *stringF; break; 58 69 } 59 60 // create terminated CanonicalForm 61 int i = strlen( stringF ); 62 char * terminatedStringF = new char[i+2]; 63 char * stringCursor = terminatedStringF; 64 while ( *stringF ) { 65 switch ( *stringF ) { 66 case '.': *stringCursor = '*'; break; 67 case '{': *stringCursor = '('; break; 68 case '}': *stringCursor = ')'; break; 69 default: *stringCursor = *stringF; break; 70 } 71 stringF++; stringCursor++; 72 } 73 *stringCursor++ = ';'; 74 *stringCursor = '\0'; 75 76 // read f and return it 77 CanonicalForm f; 78 istrstream( terminatedStringF ) >> f; 79 delete [] terminatedStringF; 80 return f; 81 } 70 stringF++; stringCursor++; 71 } 72 *stringCursor++ = ';'; 73 *stringCursor = '\0'; 74 75 // read f and return it 76 CanonicalForm f; 77 istrstream( terminatedStringF ) >> f; 78 delete [] terminatedStringF; 79 return f; 82 80 } 83 81 //}}}
Note: See TracChangeset
for help on using the changeset viewer.