Changes in / [839ccbb:05587c2]
- Location:
- src
- Files:
-
- 11 edited
-
GenPoly/InstantiateGeneric.cc (modified) (2 diffs)
-
SymTab/Validate.cc (modified) (2 diffs)
-
SynTree/Mutator.h (modified) (2 diffs)
-
SynTree/ReferenceToType.cc (modified) (2 diffs)
-
SynTree/Type.h (modified) (4 diffs)
-
SynTree/TypeSubstitution.cc (modified) (1 diff)
-
examples/Makefile.am (modified) (2 diffs)
-
examples/fstream.c (modified) (5 diffs)
-
examples/hello.c (modified) (2 diffs)
-
examples/iostream.c (modified) (10 diffs)
-
main.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/InstantiateGeneric.cc
r839ccbb r05587c2 219 219 StructDecl *concDecl = instantiations.lookup( inst ); 220 220 if ( ! concDecl ) { 221 assert( inst->get_baseParameters() && "Base struct has parameters" );222 221 // set concDecl to new type, insert type declaration into statements to add 223 222 concDecl = new StructDecl( typeNamer.newName( inst->get_name() ) ); 224 223 substituteMembers( inst->get_baseStruct()->get_members(), 225 *inst->get_baseParameters(), inst->get_parameters(),224 inst->get_baseParameters(), inst->get_parameters(), 226 225 concDecl->get_members() ); 227 226 addDeclaration( concDecl ); … … 247 246 if ( ! concDecl ) { 248 247 // set concDecl to new type, insert type declaration into statements to add 249 assert( inst->get_baseParameters() && "Base union has parameters" );250 248 concDecl = new UnionDecl( typeNamer.newName( inst->get_name() ) ); 251 249 substituteMembers( inst->get_baseUnion()->get_members(), 252 *inst->get_baseParameters(), inst->get_parameters(),250 inst->get_baseParameters(), inst->get_parameters(), 253 251 concDecl->get_members() ); 254 252 addDeclaration( concDecl ); -
src/SymTab/Validate.cc
r839ccbb r05587c2 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Nov 19 22:31:41201513 // Update Count : 19 712 // Last Modified On : Tue Aug 11 16:59:35 2015 13 // Update Count : 196 14 14 // 15 15 … … 195 195 acceptAll( translationUnit, pass1 ); 196 196 acceptAll( translationUnit, pass2 ); 197 // need to collect all of the assignment operators prior to this point and only generate assignment operators if198 // one doesn't exist197 // need to collect all of the assignment operators prior to 198 // this point and only generate assignment operators if one doesn't exist 199 199 AddStructAssignment::addStructAssignment( translationUnit ); 200 200 acceptAll( translationUnit, pass3 ); -
src/SynTree/Mutator.h
r839ccbb r05587c2 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 19 22:26:16201513 // Update Count : 812 // Last Modified On : Thu Jul 23 23:24:18 2015 13 // Update Count : 7 14 14 // 15 15 #include <cassert> … … 103 103 inline TreeType *maybeMutate( TreeType *tree, MutatorType &mutator ) { 104 104 if ( tree ) { 105 TreeType *newnode = dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) );105 TreeType *newnode = dynamic_cast< TreeType* >( tree->acceptMutator( mutator ) ); 106 106 assert( newnode ); 107 107 return newnode; -
src/SynTree/ReferenceToType.cc
r839ccbb r05587c2 59 59 std::string StructInstType::typeString() const { return "struct"; } 60 60 61 std::list<TypeDecl*>* StructInstType::get_baseParameters() { 62 if ( ! baseStruct ) return NULL; 63 return &baseStruct->get_parameters(); 64 } 61 std::list<TypeDecl*>& StructInstType::get_baseParameters() { return baseStruct->get_parameters(); } 65 62 66 63 void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { … … 71 68 std::string UnionInstType::typeString() const { return "union"; } 72 69 73 std::list<TypeDecl*>* UnionInstType::get_baseParameters() { 74 if ( ! baseUnion ) return NULL; 75 return &baseUnion->get_parameters(); 76 } 70 std::list<TypeDecl*>& UnionInstType::get_baseParameters() { return baseUnion->get_parameters(); } 77 71 78 72 void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { -
src/SynTree/Type.h
r839ccbb r05587c2 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Nov 20 12:54:09201513 // Update Count : 1 512 // Last Modified On : Thu Jul 9 16:46:15 2015 13 // Update Count : 14 14 14 // 15 15 … … 201 201 std::list<DeclarationWithType*> parameters; 202 202 203 // Does the function accept a variable number of arguments following the arguments specified in the parameters list.204 // This could be because of203 // does the function accept a variable number of arguments following the arguments 204 // specified in the parameters list. This could be because of 205 205 // - an ellipsis in a prototype declaration 206 206 // - an unprototyped declaration … … 238 238 void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; } 239 239 240 /// Accesses generic parameters of base struct (NULL if none such)241 std::list<TypeDecl*> *get_baseParameters();240 /// Accesses generic parameters of base struct 241 std::list<TypeDecl*>& get_baseParameters(); 242 242 243 243 /// Looks up the members of this struct named "name" and places them into "foundDecls". … … 265 265 void set_baseUnion( UnionDecl *newValue ) { baseUnion = newValue; } 266 266 267 /// Accesses generic parameters of base union (NULL if none such)268 std::list<TypeDecl*> *get_baseParameters();267 /// Accesses generic parameters of base union 268 std::list<TypeDecl*>& get_baseParameters(); 269 269 270 270 /// looks up the members of this union named "name" and places them into "foundDecls" -
src/SynTree/TypeSubstitution.cc
r839ccbb r05587c2 147 147 } // if 148 148 // bind type variables from generic type instantiations 149 std::list< TypeDecl* > *baseParameters = type->get_baseParameters(); 150 if ( baseParameters && ! type->get_parameters().empty() ) { 151 for ( std::list< TypeDecl* >::const_iterator tyvar = baseParameters->begin(); tyvar != baseParameters->end(); ++tyvar ) { 152 boundVars.insert( (*tyvar)->get_name() ); 153 } // for 154 } // if 149 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_baseParameters().begin(); tyvar != type->get_baseParameters().end(); ++tyvar ) { 150 boundVars.insert( (*tyvar)->get_name() ); 151 } // for 155 152 Type *ret = Mutator::mutate( type ); 156 153 boundVars = oldBoundVars; -
src/examples/Makefile.am
r839ccbb r05587c2 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Fri Nov 20 16:03:46 201514 ## Update Count : 2 413 ## Last Modified On : Thu Nov 19 18:01:56 2015 14 ## Update Count : 23 15 15 ############################################################################### 16 16 … … 19 19 CC = @CFA_BINDIR@/cfa 20 20 21 noinst_PROGRAMS = fstream_test vector_test # build but do not install21 noinst_PROGRAMS = fstream_test vector_test 22 22 fstream_test_SOURCES = iostream.c fstream.c fstream_test.c iterator.c 23 23 vector_test_SOURCES = vector_int.c fstream.c iostream.c array.c iterator.c vector_test.c -
src/examples/fstream.c
r839ccbb r05587c2 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 19 22:43:31201513 // Update Count : 412 // Last Modified On : Wed May 27 18:12:33 2015 13 // Update Count : 2 14 14 // 15 15 … … 30 30 fwrite( data, size, 1, os->file ); 31 31 os->fail = ferror( os->file ); 32 } // if32 } 33 33 return os; 34 } // write34 } 35 35 36 36 int fail( ofstream *os ) { 37 37 return os->fail; 38 } // fail38 } 39 39 40 40 static ofstream *make_ofstream() { … … 42 42 new_stream->fail = 0; 43 43 return new_stream; 44 } // make_ofstream44 } 45 45 46 46 ofstream *ofstream_stdout() { … … 48 48 stdout_stream->file = stdout; 49 49 return stdout_stream; 50 } // ofstream_stdout50 } 51 51 52 52 ofstream *ofstream_stderr() { … … 54 54 stderr_stream->file = stderr; 55 55 return stderr_stream; 56 } // ofstream_stderr56 } 57 57 58 58 ofstream *ofstream_fromfile( const char *name ) { -
src/examples/hello.c
r839ccbb r05587c2 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Nov 20 16:02:50201513 // Update Count : 312 // Last Modified On : Wed May 27 18:14:58 2015 13 // Update Count : 1 14 14 // 15 15 … … 28 28 // Local Variables: // 29 29 // tab-width: 4 // 30 // compile-command: "cfa hello.c fstream.o iostream.o iterator.o" //30 // compile-command: "cfa hello.c fstream.o iostream.o" // 31 31 // End: // -
src/examples/iostream.c
r839ccbb r05587c2 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Nov 20 13:19:19201513 // Update Count : 912 // Last Modified On : Thu Nov 19 17:54:38 2015 13 // Update Count : 4 14 14 // 15 15 … … 17 17 extern "C" { 18 18 #include <stdio.h> 19 #include <string.h> // strlen 19 //#include <string.h> 20 //#include <ctype.h> 21 typedef long unsigned int size_t; 22 size_t strlen(const char *s); 20 23 } 21 24 … … 23 26 ostype * ?<<?( ostype *os, char c ) { 24 27 return write( os, &c, 1 ); 25 } // ?<<?28 } 26 29 27 30 forall( dtype ostype | ostream( ostype ) ) … … 30 33 sprintf( buffer, "%d", i ); 31 34 return write( os, buffer, strlen( buffer ) ); 32 } // ?<<?35 } 33 36 34 37 forall( dtype ostype | ostream( ostype ) ) … … 37 40 sprintf( buffer, "%g", d ); 38 41 return write( os, buffer, strlen( buffer ) ); 39 } // ?<<?42 } 40 43 41 44 forall( dtype ostype | ostream( ostype ) ) 42 45 ostype * ?<<?( ostype *os, const char *cp ) { 43 46 return write( os, cp, strlen( cp ) ); 44 } // ?<<?47 } 45 48 46 49 forall( dtype ostype | ostream( ostype ) ) … … 49 52 sprintf( buffer, "%p", p ); 50 53 return write( os, buffer, strlen( buffer ) ); 51 } // ?<<?54 } 52 55 53 56 forall( type elt_type | writeable( elt_type ), … … 59 62 } 60 63 for_each( begin, end, print ); 61 } // ?<<?64 } 62 65 63 66 forall( type elt_type | writeable( elt_type ), … … 69 72 } 70 73 for_each_reverse( begin, end, print ); 71 } // ?<<?74 } 72 75 73 76 … … 75 78 istype * ?>>?( istype *is, char *cp ) { 76 79 return read( is, cp, 1 ); 77 } // ?>>?80 } 78 81 79 82 forall( dtype istype | istream( istype ) ) … … 97 100 unread( is, cur ); 98 101 return is; 99 } // ?>>?102 } 100 103 101 104 // Local Variables: // -
src/main.cc
r839ccbb r05587c2 9 9 // Author : Richard C. Bilson 10 10 // Created On : Fri May 15 23:12:02 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Nov 19 22:31:40201513 // Update Count : 16 811 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Jul 30 16:08:18 2015 13 // Update Count : 167 14 14 // 15 15 … … 227 227 } // if 228 228 229 // add the assignment statement after the initialization of a type parameter 229 // add the assignment statement after the 230 // initialization of a type parameter 230 231 OPTPRINT( "validate" ) 231 232 SymTab::validate( translationUnit, symtabp );
Note:
See TracChangeset
for help on using the changeset viewer.