Changeset 839ccbb for src/examples


Ignore:
Timestamp:
Nov 20, 2015, 4:19:13 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
5189888
Parents:
05587c2 (diff), ed94eac (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Peter A. Buhr <pabuhr@…> (11/20/15 12:51:58)
git-committer:
Peter A. Buhr <pabuhr@…> (11/20/15 16:19:13)
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

Location:
src/examples
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/examples/Makefile.am

    r05587c2 r839ccbb  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Thu Nov 19 18:01:56 2015
    14 ## Update Count     : 23
     13## Last Modified On : Fri Nov 20 16:03:46 2015
     14## Update Count     : 24
    1515###############################################################################
    1616
     
    1919CC = @CFA_BINDIR@/cfa
    2020
    21 noinst_PROGRAMS = fstream_test vector_test
     21noinst_PROGRAMS = fstream_test vector_test # build but do not install
    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

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

    r05587c2 r839ccbb  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 27 18:14:58 2015
    13 // Update Count     : 1
     12// Last Modified On : Fri Nov 20 16:02:50 2015
     13// Update Count     : 3
    1414//
    1515
     
    2828// Local Variables: //
    2929// tab-width: 4 //
    30 // compile-command: "cfa hello.c fstream.o iostream.o" //
     30// compile-command: "cfa hello.c fstream.o iostream.o iterator.o" //
    3131// End: //
  • src/examples/iostream.c

    r05587c2 r839ccbb  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov 19 17:54:38 2015
    13 // Update Count     : 4
     12// Last Modified On : Fri Nov 20 13:19:19 2015
     13// Update Count     : 9
    1414//
    1515
     
    1717extern "C" {
    1818#include <stdio.h>
    19 //#include <string.h>
    20 //#include <ctype.h>
    21         typedef long unsigned int size_t;
    22         size_t strlen(const char *s);
     19#include <string.h>                                                                             // strlen
    2320}
    2421
     
    2623ostype * ?<<?( ostype *os, char c ) {
    2724        return write( os, &c, 1 );
    28 }
     25} // ?<<?
    2926
    3027forall( dtype ostype | ostream( ostype ) )
     
    3330        sprintf( buffer, "%d", i );
    3431        return write( os, buffer, strlen( buffer ) );
    35 }
     32} // ?<<?
    3633
    3734forall( dtype ostype | ostream( ostype ) )
     
    4037        sprintf( buffer, "%g", d );
    4138        return write( os, buffer, strlen( buffer ) );
    42 }
     39} // ?<<?
    4340
    4441forall( dtype ostype | ostream( ostype ) )
    4542ostype * ?<<?( ostype *os, const char *cp ) {
    4643        return write( os, cp, strlen( cp ) );
    47 }
     44} // ?<<?
    4845
    4946forall( dtype ostype | ostream( ostype ) )
     
    5249        sprintf( buffer, "%p", p );
    5350        return write( os, buffer, strlen( buffer ) );
    54 }
     51} // ?<<?
    5552
    5653forall( type elt_type | writeable( elt_type ),
     
    6259        }
    6360        for_each( begin, end, print );
    64 }
     61} // ?<<?
    6562
    6663forall( type elt_type | writeable( elt_type ),
     
    7269        }
    7370        for_each_reverse( begin, end, print );
    74 }
     71} // ?<<?
    7572
    7673
     
    7875istype * ?>>?( istype *is, char *cp ) {
    7976        return read( is, cp, 1 );
    80 }
     77} // ?>>?
    8178
    8279forall( dtype istype | istream( istype ) )
     
    10097        unread( is, cur );
    10198        return is;
    102 }
     99} // ?>>?
    103100
    104101// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.