Ignore:
Timestamp:
Jan 8, 2016, 10:37:10 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:
61f9356
Parents:
1cced28
Message:

fix recursive include bug in shadow includes, major clean of examples, add several long long routines to prelude

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/iostream.c

    r1cced28 r784deab  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Dec  7 23:08:02 2015
    13 // Update Count     : 24
     12// Last Modified On : Mon Jan  4 09:38:58 2016
     13// Update Count     : 37
    1414//
    1515
     
    2727forall( dtype ostype | ostream( ostype ) )
    2828ostype * ?|?( ostype *os, int i ) {
    29         char buffer[32];                                                                        // larger than the largest integer
    30         sprintf( buffer, "%d", i );
    31         return write( os, buffer, strlen( buffer ) );
     29        char buffer[32];
     30        return write( os, buffer, sprintf( buffer, "%d", i ) );
     31} // ?|?
     32
     33forall( dtype ostype | ostream( ostype ) )
     34ostype * ?|?( ostype *os, unsigned int i ) {
     35        char buffer[32];
     36        return write( os, buffer, sprintf( buffer, "%u", i ) );
     37} // ?|?
     38
     39forall( dtype ostype | ostream( ostype ) )
     40ostype * ?|?( ostype *os, long int i ) {
     41        char buffer[32];
     42        return write( os, buffer, sprintf( buffer, "%ld", i ) );
     43} // ?|?
     44
     45forall( dtype ostype | ostream( ostype ) )
     46ostype * ?|?( ostype *os, long long int i ) {
     47        char buffer[32];
     48        return write( os, buffer, sprintf( buffer, "%lld", i ) );
     49} // ?|?
     50
     51forall( dtype ostype | ostream( ostype ) )
     52ostype * ?|?( ostype *os, unsigned long int i ) {
     53        char buffer[32];
     54        return write( os, buffer, sprintf( buffer, "%lu", i ) );
     55} // ?|?
     56
     57forall( dtype ostype | ostream( ostype ) )
     58ostype * ?|?( ostype *os, unsigned long long int i ) {
     59        char buffer[32];
     60        return write( os, buffer, sprintf( buffer, "%llu", i ) );
    3261} // ?|?
    3362
    3463forall( dtype ostype | ostream( ostype ) )
    3564ostype * ?|?( ostype *os, double d ) {
    36         char buffer[32];                                                                        // larger than the largest double
    37         sprintf( buffer, "%g", d );
    38         return write( os, buffer, strlen( buffer ) );
     65        char buffer[32];
     66        return write( os, buffer, sprintf( buffer, "%g", d ) );
     67} // ?|?
     68
     69forall( dtype ostype | ostream( ostype ) )
     70ostype * ?|?( ostype *os, long double d ) {
     71        char buffer[32];
     72        return write( os, buffer, sprintf( buffer, "%Lg", d ) );
     73} // ?|?
     74
     75forall( dtype ostype | ostream( ostype ) )
     76ostype * ?|?( ostype *os, const void *p ) {
     77        char buffer[32];
     78        return write( os, buffer, sprintf( buffer, "%p", p ) );
    3979} // ?|?
    4080
     
    4282ostype * ?|?( ostype *os, const char *cp ) {
    4383        return write( os, cp, strlen( cp ) );
    44 } // ?|?
    45 
    46 forall( dtype ostype | ostream( ostype ) )
    47 ostype * ?|?( ostype *os, const void *p ) {
    48         char buffer[32];                                                                        // larger than the largest pointer
    49         sprintf( buffer, "%p", p );
    50         return write( os, buffer, strlen( buffer ) );
    5184} // ?|?
    5285
Note: See TracChangeset for help on using the changeset viewer.