Changes in / [839ccbb:05587c2]


Ignore:
Location:
src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/InstantiateGeneric.cc

    r839ccbb r05587c2  
    219219                StructDecl *concDecl = instantiations.lookup( inst );
    220220                if ( ! concDecl ) {
    221                         assert( inst->get_baseParameters() && "Base struct has parameters" );
    222221                        // set concDecl to new type, insert type declaration into statements to add
    223222                        concDecl = new StructDecl( typeNamer.newName( inst->get_name() ) );
    224223                        substituteMembers( inst->get_baseStruct()->get_members(),
    225                                                                 *inst->get_baseParameters(), inst->get_parameters(),
     224                                                                inst->get_baseParameters(), inst->get_parameters(),
    226225                                                                concDecl->get_members() );
    227226                        addDeclaration( concDecl );
     
    247246                if ( ! concDecl ) {
    248247                        // set concDecl to new type, insert type declaration into statements to add
    249                         assert( inst->get_baseParameters() && "Base union has parameters" );
    250248                        concDecl = new UnionDecl( typeNamer.newName( inst->get_name() ) );
    251249                        substituteMembers( inst->get_baseUnion()->get_members(),
    252                                                                 *inst->get_baseParameters(), inst->get_parameters(),
     250                                                                inst->get_baseParameters(), inst->get_parameters(),
    253251                                                                concDecl->get_members() );
    254252                        addDeclaration( concDecl );
  • src/SymTab/Validate.cc

    r839ccbb r05587c2  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov 19 22:31:41 2015
    13 // Update Count     : 197
     12// Last Modified On : Tue Aug 11 16:59:35 2015
     13// Update Count     : 196
    1414//
    1515
     
    195195                acceptAll( translationUnit, pass1 );
    196196                acceptAll( translationUnit, pass2 );
    197                 // need to collect all of the assignment operators prior to this point and only generate assignment operators if
    198                 // one doesn't exist
     197                // need to collect all of the assignment operators prior to
     198                // this point and only generate assignment operators if one doesn't exist
    199199                AddStructAssignment::addStructAssignment( translationUnit );
    200200                acceptAll( translationUnit, pass3 );
  • src/SynTree/Mutator.h

    r839ccbb r05587c2  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov 19 22:26:16 2015
    13 // Update Count     : 8
     12// Last Modified On : Thu Jul 23 23:24:18 2015
     13// Update Count     : 7
    1414//
    1515#include <cassert>
     
    103103inline TreeType *maybeMutate( TreeType *tree, MutatorType &mutator ) {
    104104        if ( tree ) {
    105                 TreeType *newnode = dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) );
     105                TreeType *newnode = dynamic_cast< TreeType* >( tree->acceptMutator( mutator ) );
    106106                assert( newnode );
    107107                return newnode;
  • src/SynTree/ReferenceToType.cc

    r839ccbb r05587c2  
    5959std::string StructInstType::typeString() const { return "struct"; }
    6060
    61 std::list<TypeDecl*>* StructInstType::get_baseParameters() {
    62         if ( ! baseStruct ) return NULL;
    63         return &baseStruct->get_parameters();
    64 }
     61std::list<TypeDecl*>& StructInstType::get_baseParameters() { return baseStruct->get_parameters(); }
    6562
    6663void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
     
    7168std::string UnionInstType::typeString() const { return "union"; }
    7269
    73 std::list<TypeDecl*>* UnionInstType::get_baseParameters() {
    74         if ( ! baseUnion ) return NULL;
    75         return &baseUnion->get_parameters();
    76 }
     70std::list<TypeDecl*>& UnionInstType::get_baseParameters() { return baseUnion->get_parameters(); }
    7771
    7872void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
  • src/SynTree/Type.h

    r839ccbb r05587c2  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov 20 12:54:09 2015
    13 // Update Count     : 15
     12// Last Modified On : Thu Jul  9 16:46:15 2015
     13// Update Count     : 14
    1414//
    1515
     
    201201        std::list<DeclarationWithType*> parameters;
    202202
    203         // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
    204         // This could be because of
     203        // does the function accept a variable number of arguments following the arguments
     204        // specified in the parameters list.    This could be because of
    205205        // - an ellipsis in a prototype declaration
    206206        // - an unprototyped declaration
     
    238238        void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; }
    239239
    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();
    242242       
    243243        /// Looks up the members of this struct named "name" and places them into "foundDecls".
     
    265265        void set_baseUnion( UnionDecl *newValue ) { baseUnion = newValue; }
    266266
    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();
    269269       
    270270        /// looks up the members of this union named "name" and places them into "foundDecls"
  • src/SynTree/TypeSubstitution.cc

    r839ccbb r05587c2  
    147147        } // if
    148148        // 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
    155152        Type *ret = Mutator::mutate( type );
    156153        boundVars = oldBoundVars;
  • src/examples/Makefile.am

    r839ccbb r05587c2  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Fri Nov 20 16:03:46 2015
    14 ## Update Count     : 24
     13## Last Modified On : Thu Nov 19 18:01:56 2015
     14## Update Count     : 23
    1515###############################################################################
    1616
     
    1919CC = @CFA_BINDIR@/cfa
    2020
    21 noinst_PROGRAMS = fstream_test vector_test # build but do not install
     21noinst_PROGRAMS = fstream_test vector_test
    2222fstream_test_SOURCES = iostream.c fstream.c fstream_test.c iterator.c
    2323vector_test_SOURCES = vector_int.c fstream.c iostream.c array.c iterator.c vector_test.c
  • src/examples/fstream.c

    r839ccbb r05587c2  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov 19 22:43:31 2015
    13 // Update Count     : 4
     12// Last Modified On : Wed May 27 18:12:33 2015
     13// Update Count     : 2
    1414//
    1515
     
    3030                fwrite( data, size, 1, os->file );
    3131                os->fail = ferror( os->file );
    32         } // if
     32        }
    3333        return os;
    34 } // write
     34}
    3535
    3636int fail( ofstream *os ) {
    3737        return os->fail;
    38 } // fail
     38}
    3939
    4040static ofstream *make_ofstream() {
     
    4242        new_stream->fail = 0;
    4343        return new_stream;
    44 } // make_ofstream
     44}
    4545
    4646ofstream *ofstream_stdout() {
     
    4848        stdout_stream->file = stdout;
    4949        return stdout_stream;
    50 } // ofstream_stdout
     50}
    5151
    5252ofstream *ofstream_stderr() {
     
    5454        stderr_stream->file = stderr;
    5555        return stderr_stream;
    56 } // ofstream_stderr
     56}
    5757
    5858ofstream *ofstream_fromfile( const char *name ) {
  • src/examples/hello.c

    r839ccbb r05587c2  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov 20 16:02:50 2015
    13 // Update Count     : 3
     12// Last Modified On : Wed May 27 18:14:58 2015
     13// Update Count     : 1
    1414//
    1515
     
    2828// Local Variables: //
    2929// 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" //
    3131// End: //
  • src/examples/iostream.c

    r839ccbb r05587c2  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov 20 13:19:19 2015
    13 // Update Count     : 9
     12// Last Modified On : Thu Nov 19 17:54:38 2015
     13// Update Count     : 4
    1414//
    1515
     
    1717extern "C" {
    1818#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);
    2023}
    2124
     
    2326ostype * ?<<?( ostype *os, char c ) {
    2427        return write( os, &c, 1 );
    25 } // ?<<?
     28}
    2629
    2730forall( dtype ostype | ostream( ostype ) )
     
    3033        sprintf( buffer, "%d", i );
    3134        return write( os, buffer, strlen( buffer ) );
    32 } // ?<<?
     35}
    3336
    3437forall( dtype ostype | ostream( ostype ) )
     
    3740        sprintf( buffer, "%g", d );
    3841        return write( os, buffer, strlen( buffer ) );
    39 } // ?<<?
     42}
    4043
    4144forall( dtype ostype | ostream( ostype ) )
    4245ostype * ?<<?( ostype *os, const char *cp ) {
    4346        return write( os, cp, strlen( cp ) );
    44 } // ?<<?
     47}
    4548
    4649forall( dtype ostype | ostream( ostype ) )
     
    4952        sprintf( buffer, "%p", p );
    5053        return write( os, buffer, strlen( buffer ) );
    51 } // ?<<?
     54}
    5255
    5356forall( type elt_type | writeable( elt_type ),
     
    5962        }
    6063        for_each( begin, end, print );
    61 } // ?<<?
     64}
    6265
    6366forall( type elt_type | writeable( elt_type ),
     
    6972        }
    7073        for_each_reverse( begin, end, print );
    71 } // ?<<?
     74}
    7275
    7376
     
    7578istype * ?>>?( istype *is, char *cp ) {
    7679        return read( is, cp, 1 );
    77 } // ?>>?
     80}
    7881
    7982forall( dtype istype | istream( istype ) )
     
    97100        unread( is, cur );
    98101        return is;
    99 } // ?>>?
     102}
    100103
    101104// Local Variables: //
  • src/main.cc

    r839ccbb r05587c2  
    99// Author           : Richard C. Bilson
    1010// Created On       : Fri May 15 23:12:02 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov 19 22:31:40 2015
    13 // Update Count     : 168
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Thu Jul 30 16:08:18 2015
     13// Update Count     : 167
    1414//
    1515
     
    227227                } // if
    228228
    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
    230231                OPTPRINT( "validate" )
    231232                SymTab::validate( translationUnit, symtabp );
Note: See TracChangeset for help on using the changeset viewer.