Ignore:
Timestamp:
Jan 7, 2015, 6:04:42 PM (10 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:
0b8cd722
Parents:
d9a0e76
Message:

fixed restrict, fixed parameter copy, introduced name table for types, changed variable after to string

Location:
translator/examples
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • translator/examples/Makefile

    rd9a0e76 r17cd4eb  
    2020
    2121${EXEC1} : ${OBJECTS1}                          # link step 1st executable
    22         ${CC} ${CCFLAGS} $^ -o $@               # additional object files before $^
     22        ${CC} ${CFLAGS} $^ -o $@                # additional object files before $^
    2323
    2424${EXEC2} : ${OBJECTS2}                          # link step 2nd executable
    25         ${CC} ${CCFLAGS} $^ -o $@               # additional object files before $^
     25        ${CC} ${CFLAGS} $^ -o $@                # additional object files before $^
    2626
    2727${OBJECTS} : ${MAKEFILE_NAME}                   # OPTIONAL : changes to this file => recompile
  • translator/examples/includes.c

    rd9a0e76 r17cd4eb  
    2525//#include <wchar.h>        // FAILS -- includes locale.h
    2626//#include <wctype.h>       // FAILS -- includes locale.h
     27#include <curses.h>
    2728#else
    28 #include <curses.h>
    29 #endif
     29#include <aio.h>
     30#endif // 0
    3031
    3132// Local Variables: //
  • translator/examples/swap.c

    rd9a0e76 r17cd4eb  
    44
    55forall( type T )
    6 void swap( T left, T right ) {
    7     T temp = left;
    8     left = right;
    9     right = temp;
     6T swap( T *left, T *right ) {
     7    T temp;
     8    temp = *left;
     9    *left = *right;
     10    *right = temp;
     11    return *right;
    1012}
    1113
    1214int main() {
    1315    int x = 1, y = 2;
    14     printf( "%d %d", x, y );
    15     swap( x, y );
    16     printf( "%d %d", x, y );
     16    printf( "%d %d\n", x, y );
     17    int w;
     18    w = swap( &x, &y );
     19    printf( "%d %d %d\n", w, x, y );
    1720}
    1821
  • translator/examples/vector_test.c

    rd9a0e76 r17cd4eb  
    2222    sout << "Array elements:\n";
    2323//    write_all( begin( vec ), end( vec ), sout );
    24     sout << "\n";
    25 #if 0
    26     write_reverse( begin( vec ), end( vec ), sout );
    27     sout << "\n";
    28 
    29 #endif
     24//    sout << "\n";
    3025    for ( int index = 0; index <= last( vec ); index += 1 ) {
    3126        sout << vec[ index ] << " ";
    3227    }
    3328    sout << "\n";
     29#if 1
     30    sout << "Array elements reversed:\n";
     31    write_reverse( begin( vec ), end( vec ), sout );
     32    sout << "\n";
     33#endif
    3434}
    3535
Note: See TracChangeset for help on using the changeset viewer.