Changeset 1b7ea43 for src/examples


Ignore:
Timestamp:
May 4, 2016, 2:58:28 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
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, with_gc
Children:
711eee5
Parents:
1048b31 (diff), 7937abf (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.
Message:

Merge branch 'master' into global-init

Location:
src/examples
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/examples/abstype.c

    r1048b31 r1b7ea43  
    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:10:01 2015
    13 // Update Count     : 4
     12// Last Modified On : Wed Apr  6 22:16:08 2016
     13// Update Count     : 8
    1414//
    1515
    16 type T | { T x( T ); };
     16otype T | { T x( T ); };
    1717
    1818T y( T t ) {
     
    2121}
    2222
    23 forall(type T) lvalue T *?( T* );
    24 int ?++( int *);
    25 int ?=?( int*, int );
    26 forall(dtype DT) DT* ?=?( DT **, DT* );
     23forall( otype T ) lvalue T *?( T* );
     24int ?++( int * );
     25int ?=?( int *, int );
     26forall( dtype DT ) DT * ?=?( DT **, DT* );
    2727
    28 type U = int*;
     28otype U = int *;
    2929
    3030U x( U u ) {
  • src/examples/alloc.c

    r1048b31 r1b7ea43  
    1111// Created On       : Wed Feb  3 07:56:22 2016
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Wed Feb 17 11:43:23 2016
    14 // Update Count     : 40
     13// Last Modified On : Fri Mar 11 17:42:08 2016
     14// Update Count     : 59
    1515//
    1616
     17forall( otype T ) T * malloc( char fill );
     18forall( dtype T ) T *?=?( T **, void * );
     19void *malloc( unsigned long int );
     20#if 0
    1721#include <fstream>
    1822#include <stdlib>
     
    2529int * bar( int * p, int c ) { return p; }
    2630int * baz( int * p, int c ) { return p; }
     31#endif
    2732
    2833int main( void ) {
     34#if 0
    2935    size_t size = 10;
    3036    int * p;
    3137    struct S { int x; double y; } * s;
     38#endif
    3239
     40#if 0
    3341    p = malloc( sizeof(*p) );                                                   // C malloc, type unsafe
    3442        printf( "here1\n" );
     
    3745        printf( "here2\n" );
    3846    free( p );
    39     p = malloc( (char)'\0' );                                                                   // CFA malloc, type safe
     47#endif
     48//    int * p;
     49//    p = malloc( (char)'\0' );                                                                 // CFA malloc, type safe
     50    (int *)malloc( (char)'\0' );                                                                        // CFA malloc, type safe
     51    (void *)malloc( (char)'\0' );                                                                       // CFA malloc, type safe
     52#if 0
    4053        printf( "here3\n" );
    4154    p = malloc( p, 1000 );                                                              // CFA remalloc, type safe
     
    6073        printf( "here9\n" );
    6174    free( p );
    62 #if 0
     75
    6376    float * fp = malloc() + 1;
    6477    fprintf( stderr, "%p %p\n", fp, fp - 1 );
  • src/examples/fstream_test.c

    r1048b31 r1b7ea43  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Mar  6 20:58:29 2016
    13 // Update Count     : 54
     12// Last Modified On : Mon May  2 15:25:54 2016
     13// Update Count     : 61
    1414//
    1515
  • src/examples/includes.c

    r1048b31 r1b7ea43  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 23:28:02 2016
    13 // Update Count     : 328
     12// Last Modified On : Wed Apr 13 22:30:02 2016
     13// Update Count     : 370
    1414//
    1515
     
    2424#if 1
    2525#define _GNU_SOURCE
    26 #include <aio.h>
    27 #include <a.out.h>
    28 #include <aliases.h>
    29 #include <alloca.h>
    30 #include <ansidecl.h>
    31 #include <ar.h>
    32 #include <argp.h>
     26//#include <aio.h>
     27//#include <a.out.h>
     28//#include <aliases.h>
     29//#include <alloca.h>
     30//#include <ansidecl.h>
     31//#include <ar.h>
     32//#include <argp.h>
    3333#include <argz.h>
    34 #include <assert.h>
     34//#include <assert.h>
    3535#include <bfd.h>
     36#if 0
    3637#include <bfdlink.h>
    3738#include <byteswap.h>
     
    5657#include <err.h>
    5758#include <errno.h>
    58 #if 0
    5959#include <error.h>
    60 #endif
    6160#include <eti.h>
    6261#include <evdns.h>
    6362#include <event.h>
    6463#include <evhttp.h>
     64#endif
    6565#if 0
    6666#include <evrpc.h>
     
    129129
    130130//#define _GNU_SOURCE
    131 #include <error.h>
     131#include <bfd.h>
     132//#include <error.h>
    132133
    133134#endif // 0
  • src/examples/sum.c

    r1048b31 r1b7ea43  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  4 15:06:47 2016
    13 // Update Count     : 196
     12// Last Modified On : Mon May  2 15:07:57 2016
     13// Update Count     : 198
    1414//
    1515
     
    4848        } // for
    4949        sout | "sum from" | low | "to" | High | "is"
    50                  | (int)sum( size, a ) | "" | ", check" | (int)s | endl;
     50                 | (int)sum( size, a ) | ", check" | (int)s | endl;
    5151
    5252        int s = 0, a[size], v = low;
     
    5656        } // for
    5757        sout | "sum from" | low | "to" | High | "is"
    58                  | sum( size, (int *)a ) | "" | ", check" | (int)s | endl;
     58                 | sum( size, (int *)a ) | ", check" | (int)s | endl;
    5959
    6060        float s = 0.0, a[size], v = low / 10.0;
     
    6464        } // for
    6565        sout | "sum from" | low / 10.0 | "to" | High / 10.0 | "is"
    66                  | sum( size, (float *)a ) | "" | ", check" | (float)s | endl;
     66                 | sum( size, (float *)a ) | ", check" | (float)s | endl;
    6767
    6868        double s = 0, a[size], v = low / 10.0;
     
    7272        } // for
    7373        sout | "sum from" | low / 10.0 | "to" | High / 10.0 | "is"
    74                  | sum( size, (double *)a ) | "" | ", check" | (double)s | endl;
     74                 | sum( size, (double *)a ) | ", check" | (double)s | endl;
    7575
    7676        struct S { int i, j; } 0 = { 0, 0 }, 1 = { 1, 1 };
     
    8787        } // for
    8888        sout | "sum from" | low | "to" | High | "is"
    89                  | sum( size, (S *)a ) | "" | ", check" | (S)s | endl;
     89                 | sum( size, (S *)a ) | ", check" | (S)s | endl;
    9090} // main
    9191
Note: See TracChangeset for help on using the changeset viewer.