Changeset 200fcb3 for examples


Ignore:
Timestamp:
Dec 12, 2018, 9:16:12 AM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
5ebb1368
Parents:
3d99498
Message:

add auto newline to sout, change endl to nl

Location:
examples
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • examples/ArrayN.c

    r3d99498 r200fcb3  
    77
    88forall(otype index_t)
    9 index_t offset_to_index(unsigned offset, index_t size)
    10 {
     9index_t offset_to_index(unsigned offset, index_t size) {
    1110    return [offset / size.0, offset % size.1];
    1211}
    1312
    14 int main(int argc, char* argv[])
    15 {
     13int main(int argc, char* argv[]) {
    1614    unsigned x = 0, y = 0, i = 0;
    1715    unsigned sx = 4, sy = 4;
     
    2018    [x, y] = offset_to_index(6, [sx, sy]);
    2119
    22     sout | x | ' ' | y | endl;
     20    sout | x | ' ' | y;
    2321
    2422    return 0;
  • examples/gc_no_raii/src/internal/collector.c

    r3d99498 r200fcb3  
    3838void* gc_allocate(size_t target_size)
    3939{
    40         // sout | "Allocating " | target_size | " bytes" | endl;
     40        // sout | "Allocating " | target_size | " bytes";
    4141
    4242        size_t size = gc_compute_size(target_size + sizeof(gc_object_header));
    4343
    44         // sout | "Object header size: " | sizeof(gc_object_header) | " bytes" | endl;
    45         // sout | "Actual allocation size: " | size | " bytes" | endl;
     44        // sout | "Object header size: " | sizeof(gc_object_header) | " bytes";
     45        // sout | "Actual allocation size: " | size | " bytes";
    4646
    4747        check(size < POOL_SIZE_BYTES);
  • examples/gc_no_raii/src/internal/state.h

    r3d99498 r200fcb3  
    3838static inline bool gc_needs_collect(gc_state* state)
    3939{
    40         // sout | "Used Space: " | state->used_space | " bytes" | endl;
     40        // sout | "Used Space: " | state->used_space | " bytes";
    4141        return state->used_space * 2 > state->total_space;
    4242}
  • examples/gc_no_raii/src/tools/print.h

    r3d99498 r200fcb3  
    55// #include <fstream.hfa>
    66//
    7 // #define DEBUG_OUT(x) sout | x | endl;
     7// #define DEBUG_OUT(x) sout | x;
    88//
    99// #else
  • examples/multicore.c

    r3d99498 r200fcb3  
    1515
    1616int main(int argc, char* argv[]) {
    17         // sout | "User main begin" | endl;
     17        // sout | "User main begin";
    1818        {
    1919                processor p;
     
    2222                }
    2323        }
    24         // sout | "User main end" | endl;
     24        // sout | "User main end";
    2525}
  • examples/prolog.c

    r3d99498 r200fcb3  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  8 22:09:39 2016
    13 // Update Count     : 5
     12// Last Modified On : Tue Dec 11 23:27:19 2018
     13// Update Count     : 6
    1414//
    1515
    1616#include <fstream.hfa>
    1717
    18 void printResult( int x ) { sout | "int" | endl; }
    19 void printResult( double x ) { sout | "double" | endl; }
    20 void printResult( char * x ) { sout | "char*" | endl; }
     18void printResult( int x ) { sout | "int"; }
     19void printResult( double x ) { sout | "double"; }
     20void printResult( char * x ) { sout | "char*"; }
    2121
    2222void is_arithmetic( int x ) {}
  • examples/quad.c

    r3d99498 r200fcb3  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  8 22:07:02 2016
    13 // Update Count     : 8
     12// Last Modified On : Tue Dec 11 23:26:58 2018
     13// Update Count     : 9
    1414//
    1515
     
    2828int main() {
    2929        int N = 2;
    30         sout | "result of quad of" | N | "is" | quad( N ) | endl;
     30        sout | "result of quad of" | N | "is" | quad( N );
    3131}
    3232
  • examples/square.c

    r3d99498 r200fcb3  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  8 22:05:48 2016
    13 // Update Count     : 27
     12// Last Modified On : Tue Dec 11 23:28:24 2018
     13// Update Count     : 28
    1414//
    1515
     
    2323int main() {
    2424#if 0
    25         sout | "result of squaring 9 is " | endl;
     25        sout | "result of squaring 9 is ";
    2626
    2727        // char does not have multiplication.
     
    3030        } // ?*?
    3131        char c = 9;
    32         sout | "char\t\t\t" | square( c ) | endl;
     32        sout | "char\t\t\t" | square( c );
    3333
    34         sout | square( s ) | endl;
     34        sout | square( s );
    3535#endif
    3636        short s = 9;
     
    3838#if 0
    3939        signed int i = 9;
    40         sout | "signed int\t\t" | square( i ) | endl;
     40        sout | "signed int\t\t" | square( i );
    4141
    4242        unsigned int ui = 9;
    43         sout | "unsigned int\t\t" | square( ui ) | endl;
     43        sout | "unsigned int\t\t" | square( ui );
    4444
    4545        long int li = 9;
    46         sout | "signed long int\t\t" | square( li ) | endl;
     46        sout | "signed long int\t\t" | square( li );
    4747
    4848        unsigned long int uli = 9;
    49         sout | "unsigned long int\t" | square( uli ) | endl;
     49        sout | "unsigned long int\t" | square( uli );
    5050
    5151        signed long long int lli = 9;
    52         sout | "signed long long int\t" | square( lli ) | endl;
     52        sout | "signed long long int\t" | square( lli );
    5353
    5454        unsigned long long int ulli = 9;
    55         sout | "unsigned long long int\t" | square( ulli ) | endl;
     55        sout | "unsigned long long int\t" | square( ulli );
    5656
    5757        float f = 9.0;
    58         sout | "float\t\t\t" | square( f ) | endl;
     58        sout | "float\t\t\t" | square( f );
    5959
    6060        double d = 9.0;
    61         sout | "double\t\t\t" | square( d ) | endl;
     61        sout | "double\t\t\t" | square( d );
    6262
    6363        long double ld = 9.0;
    64         sout | "long double\t\t" | square( ld ) | endl;
     64        sout | "long double\t\t" | square( ld );
    6565#endif
    6666} // main
  • examples/twice.c

    r3d99498 r200fcb3  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct 19 21:52:57 2017
    13 // Update Count     : 46
     12// Last Modified On : Tue Dec 11 23:28:08 2018
     13// Update Count     : 47
    1414//
    1515
     
    2828
    2929int main( void ) {
    30         sout | twice( ' ' ) | ' ' | twice( (signed char)0 ) | twice( (int)1 ) | twice( 3.2 ) | endl;
     30        sout | twice( ' ' ) | ' ' | twice( (signed char)0 ) | twice( (int)1 ) | twice( 3.2 );
    3131}
    3232
  • examples/wrapper/src/main.c

    r3d99498 r200fcb3  
    11#include "pointer.h"
    22
    3 wrapper_t make_copy(wrapper_t copy)
    4 {
     3wrapper_t make_copy(wrapper_t copy) {
    54        return copy;
    65}
    76
    8 int main(int argc, char const *argv[])
    9 {
     7int main(int argc, char const *argv[]) {
    108        wrapper_t p = wrap(6);
    11 
    12         sout | endl | "test started" | endl;
    13 
     9        sout | nl | "test started";
    1410        wrapper_t p2 = p;
    15 
    1611        clear(&p);
    17 
    1812        p = p2;
    19 
    2013        wrapper_t p3 = make_copy(p2);
    21 
    22         sout | endl | "test ended" | endl;
    23 
     14        sout | nl | "test ended";
    2415        return 0;
    2516}
  • examples/wrapper/src/pointer.h

    r3d99498 r200fcb3  
    3434void ?{}(content_t* this)
    3535{
    36         sout | "Constructing content" | endl;
     36        sout | "Constructing content";
    3737        this->count = 0;
    3838}
     
    4040void ^?{}(content_t* this)
    4141{
    42         sout | "Destroying content" | endl;
     42        sout | "Destroying content";
    4343}
    4444
     
    5353void ?{}(wrapper_t* this)
    5454{
    55         sout | "Constructing empty ref pointer" | endl | endl;
     55        sout | "Constructing empty ref pointer" | nl;
    5656        this->ptr = NULL;
    5757}
     
    5959void ?{}(wrapper_t* this, wrapper_t rhs)
    6060{
    61         sout | "Constructing ref pointer from copy" | endl;
     61        sout | "Constructing ref pointer from copy";
    6262        this->ptr = rhs.ptr;
    6363        this->ptr->count++;
    64         sout | "Reference is " | this->ptr->count | endl | endl;
     64        sout | "Reference is " | this->ptr->count | nl;
    6565}
    6666
     
    6969        if(this->ptr)
    7070        {
    71                 sout | "Destroying ref pointer" | endl;
     71                sout | "Destroying ref pointer";
    7272                this->ptr->count--;
    73                 sout | "Reference is " | this->ptr->count | endl | endl;
     73                sout | "Reference is " | this->ptr->count | nl;
    7474                if(!this->ptr->count) delete(this->ptr);
    7575        }
    7676        else
    7777        {
    78                 sout | "Destroying empty ref pointer" | endl | endl;
     78                sout | "Destroying empty ref pointer" | nl;
    7979        }
    8080}
     
    8282wrapper_t ?=?(wrapper_t* this, wrapper_t rhs)
    8383{
    84         sout | "Setting ref pointer" | endl;
     84        sout | "Setting ref pointer";
    8585        if(this->ptr)
    8686        {
    8787                this->ptr->count--;
    88                 sout | "Reference is " | this->ptr->count | endl | endl;
     88                sout | "Reference is " | this->ptr->count | nl;
    8989                if(!this->ptr->count) delete(this->ptr);
    9090        }
    9191        this->ptr = rhs.ptr;
    9292        this->ptr->count++;
    93         sout | "Reference is " | this->ptr->count | endl | endl;
     93        sout | "Reference is " | this->ptr->count | nl;
    9494}
    9595
     
    9898        this->ptr = c;
    9999        this->ptr->count++;
    100         sout | "Setting ref pointer" | endl;
    101         sout | "Reference is " | this->ptr->count | endl | endl;
     100        sout | "Setting ref pointer";
     101        sout | "Reference is " | this->ptr->count | nl;
    102102}
    103103
    104104void clear(wrapper_t* this)
    105105{
    106         sout | "Clearing ref pointer" | endl;
     106        sout | "Clearing ref pointer";
    107107        this->ptr->count--;
    108         sout | "Reference is " | this->ptr->count | endl | endl;
     108        sout | "Reference is " | this->ptr->count | nl;
    109109        if(!this->ptr->count) delete(this->ptr);
    110110        this->ptr = NULL;
  • examples/zero_one.c

    r3d99498 r200fcb3  
    33void foo(zero_t o)
    44{
    5         sout | "It's a Zero!" | endl;
     5        sout | "It's a Zero!";
    66}
    77
    88void foo(one_t o)
    99{
    10         sout | "It's a One!" | endl;
     10        sout | "It's a One!";
    1111}
    1212
    1313void foo(int o)
    1414{
    15         sout | "It's a Number!" | endl;
     15        sout | "It's a Number!";
    1616}
    1717
Note: See TracChangeset for help on using the changeset viewer.