Changeset 55ba733


Ignore:
Timestamp:
Jun 14, 2016, 12:33:57 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, with_gc
Children:
e04ef3a
Parents:
4c82a3c
Message:

update keywords in test files

Location:
src/Tests
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • src/Tests/Abstype.c

    r4c82a3c r55ba733  
    1 type T | { T x( T ); };
     1otype T | { T x( T ); };
    22
    33T y( T t ) {
     
    66}
    77
    8 forall( type T ) lvalue T *?( T * );
     8forall( otype T ) lvalue T *?( T * );
    99int ?++( int * );
    1010int ?=?( int *, int );
    1111forall( dtype DT ) DT * ?=?( DT **, DT * );
    1212
    13 type U = int *;
     13otype U = int *;
    1414
    1515U x( U u ) {
  • src/Tests/Array.c

    r4c82a3c r55ba733  
    11int a1[];
    2 int a2[*];
    3 double a4[3.0];
     2//int a2[*];
     3//double a4[3.0];
    44
    55int m1[][3];
    6 int m2[*][*];
     6//int m2[*][*];
    77int m4[3][3];
    88
     
    1010
    1111int fred() {
    12         int a1[];
    13         int a2[*];
     12//      int a1[];
     13//      int a2[*];
    1414        int a4[3];
    1515        int T[3];
  • src/Tests/Attributes.c

    r4c82a3c r55ba733  
    66//    @max
    77//
    8 // 2. a direct application to a manifest type
     8// 2. a direct application to a manifest otype
    99//
    1010//    @max( int )
    1111//
    12 // 3. constraining a type variable; the application is implicitly performed at the call site as in (2)
     12// 3. constraining a otype variable; the application is implicitly performed at the call site as in (2)
    1313//
    14 //    forall( type T | { T @max( T ); } ) T x( T t );
     14//    forall( otype T | { T @max( T ); } ) T x( T t );
    1515//
    1616//
     
    2323//    x = (*attr_var);
    2424//
    25 // 2. an indirect application to a manifest type
     25// 2. an indirect application to a manifest otype
    2626//
    2727//    (*attr_var)( int )
    2828//
    29 // 3. a direct application to a type variable
     29// 3. a direct application to a otype variable
    3030//
    3131//    @max( T )
     
    4747// 3. polymorphic
    4848//
    49 //    forall( type T | constraint( T ) ) int @attr( T );
     49//    forall( otype T | constraint( T ) ) int @attr( T );
    5050
    5151int @max = 3;
     
    5353int main() {
    5454    int x;
    55     type @type(type t);                                                                 // compiler intrinsic
    56     type @widest(type t);
    57     @type(x) *y;                                                                                // gcc: typeof(x) *y;
    58     const @widest(double) *w;                                                   // gcc: const typeof(x) *w;
    59     * @type(3 + 4) z;                                                                   // cfa declaration syntax
     55    otype @otype(otype t);                                                                      // compiler intrinsic
     56    otype @widest(otype t);
     57    @otype(x) *y;                                                                               // gcc: otypeof(x) *y;
     58    const @widest(double) *w;                                                   // gcc: const otypeof(x) *w;
     59    * @otype(3 + 4) z;                                                                  // cfa declaration syntax
    6060    y = @max;           
    6161    z = @max(x) + @size(int);
  • src/Tests/Context.c

    r4c82a3c r55ba733  
    1 context has_q( type T ) {
     1context has_q( otype T ) {
    22        T q( T );
    33};
    44
    5 forall( type z | has_q( z ) ) void f() {
    6         context has_r( type T, type U ) {
     5forall( otype z | has_q( z ) ) void f() {
     6        context has_r( otype T, otype U ) {
    77                T r( T, T (T,U) );
    88        };
    99 
    10         extern type x, y | has_r( x, y );
     10        extern otype x, y | has_r( x, y );
    1111}
    1212
  • src/Tests/Forall.c

    r4c82a3c r55ba733  
    77
    88void g1() {
    9         forall( type T ) T f( T );
     9        forall( otype T ) T f( T );
    1010        void f( int );
    1111        void h( void (*p)(void) );
     
    2424
    2525void g2() {
    26         forall( type T ) void f( T, T );
    27         forall( type T, type U ) void f( T, U );
     26        forall( otype T ) void f( T, T );
     27        forall( otype T, otype U ) void f( T, U );
    2828 
    2929        int x;
     
    3737}
    3838
    39 typedef forall ( type T ) int (*f)( int );
     39typedef forall ( otype T ) int (*f)( int );
    4040
    41 forall( type T )
     41forall( otype T )
    4242void swap( T left, T right ) {
    4343        T temp = left;
     
    4646}
    4747
    48 context sumable( type T ) {
     48context sumable( otype T ) {
    4949        const T 0;
    5050        T ?+?(T, T);
     
    5353};
    5454
    55 type T1 | { const T1 0; T1 ?+?(T1, T1); T1 ?++(T1); [T1] ?+=?(T1,T1); },
    56         T2(type P1, type P2 ),
     55otype T1 | { const T1 0; T1 ?+?(T1, T1); T1 ?++(T1); [T1] ?+=?(T1,T1); },
     56        T2(otype P1, otype P2 ),
    5757        T3 | sumable(T3);
    5858
    59 type T2(type P1, type P2) | sumable(T2(P1,P2)) = struct { P1 i; P2 j; };
     59otype T2(otype P1, otype P2) | sumable(T2(P1,P2)) = struct { P1 i; P2 j; };
    6060
    6161T2(int, int) w1;
    6262typedef T2(int, int) w2;
    6363w2 g2;
    64 type w3 = T2(int, int);
     64otype w3 = T2(int, int);
    6565w3 g3;
    6666
    67 forall( type T | sumable( T ) )
     67forall( otype T | sumable( T ) )
    6868T sum( int n, T a[] ) {
    6969        T total = 0;
     
    7474}
    7575
    76 forall( type T | { const T 0; T ?+?(T, T); T ?++(T); [T] ?+=?(T,T); } )
     76forall( otype T | { const T 0; T ?+?(T, T); T ?++(T); [T] ?+=?(T,T); } )
    7777T twice( T t ) {
    7878        return t + t;
    7979}
    8080
    81 forall( type T | { const T 0; int ?!=?(T, T); int ?<?(T, T); } )
     81forall( otype T | { const T 0; int ?!=?(T, T); int ?<?(T, T); } )
    8282T min( T t1, T t2 ) {
    8383        return t1 < t2 ? t1 : t2;
  • src/Tests/Functions.c

    r4c82a3c r55ba733  
    2828int ((*f12())[])[3] {}
    2929
    30 // "implicit int" type specifier (not ANSI)
     30// "implicit int" otype specifier (not ANSI)
    3131
    3232fII1( int i ) {}
  • src/Tests/GccExtensions.c

    r4c82a3c r55ba733  
    1919    __signed s2;
    2020
    21     __typeof(s1) t1;
    22     __typeof__(s1) t2;
     21    __otypeof(s1) t1;
     22    __otypeof__(s1) t2;
    2323
    2424    __volatile int v1;
  • src/Tests/InferParam.c

    r4c82a3c r55ba733  
    33double ?=?( double*, double );
    44
    5 forall( type T, type U | { U f(T); } ) U g(T);
     5forall( otype T, otype U | { U f(T); } ) U g(T);
    66float f( int );
    77double f( int );
     
    1313}
    1414
    15 context has_f_and_j( type T, type U ) {
     15context has_f_and_j( otype T, otype U ) {
    1616        U f( T );
    1717        U j( T, U );
     
    1919
    2020float j( int, float );
    21 forall( type T, type U | has_f_and_j( T, U ) ) U k( T );
     21forall( otype T, otype U | has_f_and_j( T, U ) ) U k( T );
    2222
    2323void l() {
  • src/Tests/Makefile

    r4c82a3c r55ba733  
    1 CFA ?= ../cfa-cpp
     1CFA ?= ../driver/cfa-cpp
    22CFAOPT ?= -a
    33OUTPUT ?= Output
     
    3232
    3333${OUTPUTDIR} :
    34         mkdir $@
     34        mkdir -p $@
    3535
    3636# remove the expected results directories to generate new ones from the current output
  • src/Tests/Members.c

    r4c82a3c r55ba733  
    33float ?=?( float*, float );
    44forall( dtype DT ) DT * ?=?( DT**, DT* );
    5 forall(type T) lvalue T *?( T* );
     5forall(otype T) lvalue T *?( T* );
    66char *__builtin_memcpy();
    77
  • src/Tests/OccursError.c

    r4c82a3c r55ba733  
    1 forall( type T ) void f( void (*)( T, T* ) );
    2 forall( type U ) void g( U*, U );
     1forall( otype T ) void f( void (*)( T, T* ) );
     2forall( otype U ) void g( U*, U );
    33
    44void test() {
  • src/Tests/Quad.c

    r4c82a3c r55ba733  
    22int ?*?( int, int );
    33
    4 forall( type T | { T ?*?( T, T ); } )
     4forall( otype T | { T ?*?( T, T ); } )
    55T square( T t ) {
    66        return t * t;
    77}
    88
    9 forall( type U | { U square( U ); } )
     9forall( otype U | { U square( U ); } )
    1010U quad( U u ) {
    1111        return square( square( u ) );
  • src/Tests/Rank2.c

    r4c82a3c r55ba733  
    33
    44void a() {
    5         forall( type T ) void f( T );
    6         void g( forall( type U ) void p( U ) );
     5        forall( otype T ) void f( T );
     6        void g( forall( otype U ) void p( U ) );
    77        g( f );
    88}
     
    1010void g() {
    1111        void h( int *null );
    12         forall( type T ) T id( T );
     12        forall( otype T ) T id( T );
    1313        forall( dtype T ) T *0;
    1414        int 0;
  • src/Tests/Scope.c

    r4c82a3c r55ba733  
    33typedef float t;
    44y z;
    5 type u = struct { int a; double b; };
     5otype u = struct { int a; double b; };
    66int f( int y );
    77y q;
    88
    99y w( y y, u v ) {
    10         type x | { x t(u); };
     10        otype x | { x t(u); };
    1111        u u = y;
    1212        x z = t(u);
     
    1515y p;
    1616
    17 context has_u( type z ) {
     17context has_u( otype z ) {
    1818        z u(z);
    1919};
    2020
    21 forall( type t | has_u( t ) )
     21forall( otype t | has_u( t ) )
    2222y q( t the_t ) {
    2323        t y = u( the_t );
  • src/Tests/Subrange.c

    r4c82a3c r55ba733  
    1 // A small context defining the notion of an ordered type.  (The standard
     1// A small context defining the notion of an ordered otype.  (The standard
    22// library should probably contain a context for this purpose.)
    3 context ordered(type T) {
     3context ordered(otype T) {
    44    int ?<?(T, T), ?<=?(T, T);
    55};
    66
    7 // A subrange type resembling an Ada subtype with a base type and a range
     7// A subrange otype resembling an Ada subotype with a base otype and a range
    88// constraint.
    9 type subrange(type base_t | ordered(base_t), base_t low = 0, base_t high = 8) = base_t;
     9otype subrange(otype base_t | ordered(base_t), base_t low = 0, base_t high = 8) = base_t;
    1010
    11 // Note that subrange() can be applied to floating-point and pointer types, not
    12 // just integral types.
    13 //   This requires a "type generator" extension to Cforall.  Type generators
    14 // must accept type and non-type parameters, which is beyond what we discussed
     11// Note that subrange() can be applied to floating-point and pointer otypes, not
     12// just integral otypes.
     13//   This requires a "otype generator" extension to Cforall.  Type generators
     14// must accept otype and non-otype parameters, which is beyond what we discussed
    1515// previously.  Type parameters must be usable in the declaration of
    1616// subsequent parameters: parameter T is used to declare parameters "low"
     
    2222subrange(int, 0, (rand() & 0xF) ) foo;
    2323
    24 // What sorts of expressions can be used as arguments of type generators?  Is
     24// What sorts of expressions can be used as arguments of otype generators?  Is
    2525// "subrange(int, 0, rand() & 0xF)" legal?  Probably.  The nearest C equivalent
    2626// to the "low" and "high" arguments is the array size in a variable-length
     
    2828
    2929// Convenient access to subrange bounds, for instance for iteration:
    30 forall (type T, T low, T high)
     30forall (otype T, T low, T high)
    3131T lbound( subrange(T, low, high) v) {
    3232    return low;
    3333}
    3434
    35 forall (type T, T low, T high)
     35forall (otype T, T low, T high)
    3636T hbound( subrange(T, low, high) v) {
    3737    return high;
     
    4141unsigned lday = lbound(day_of_month);
    4242
    43 // Assignment from the base type, with bounds checking.  I'll ignore the issue
     43// Assignment from the base otype, with bounds checking.  I'll ignore the issue
    4444// of exception handling here.  Inlining allows the compiler to eliminate
    4545// bounds checks.
    46 forall (type T | ordered(T), T low, T high)
     46forall (otype T | ordered(T), T low, T high)
    4747inline subrange(T, low, high) ?=?(subrange(T, low, high)* target, T source) {
    4848    if (low <= source && source <= high) *((T*)target) = source;
     
    5151}
    5252
    53 // Assignment between subranges with a common base type.  The bounds check
     53// Assignment between subranges with a common base otype.  The bounds check
    5454// compares range bounds so that the compiler can optimize checks away when the
    5555// ranges are known to overlap.
    56 forall (type T | ordered(T), T t_low, T t_high, T s_low, T s_high)
     56forall (otype T | ordered(T), T t_low, T t_high, T s_low, T s_high)
    5757inline subrange(T, t_low, t_high) ?=?(subrange(T, t_low, t_high)* target,
    5858                                      subrange(T, s_low, s_high) source) {
  • src/Tests/TypeGenerator.c

    r4c82a3c r55ba733  
    1 context addable( type T ) {
     1context addable( otype T ) {
    22        T ?+?( T,T );
    33        T ?=?( T*, T);
    44};
    55
    6 type List1( type T | addable( T ) ) = struct { T data; List1( T ) *next; } *;
     6otype List1( otype T | addable( T ) ) = struct { T data; List1( T ) *next; } *;
    77typedef List1( int ) ListOfIntegers;
    88//List1( int ) li;
     
    1111[int] h( * List1( int ) p );                                                    // new declaration syntax
    1212
    13 struct( type T ) S2 { T i; };                                                   // actual definition
     13struct( otype T ) S2 { T i; };                                                  // actual definition
    1414struct( int ) S3 v1, *p;                                                                // expansion and instantiation
    15 struct( type T )( int ) S24 { T i; } v2;                                // actual definition, expansion and instantiation
    16 struct( type T )( int ) { T i; } v2;                                    // anonymous actual definition, expansion and instantiation
     15struct( otype T )( int ) S24 { T i; } v2;                               // actual definition, expansion and instantiation
     16struct( otype T )( int ) { T i; } v2;                                   // anonymous actual definition, expansion and instantiation
    1717
    18 struct( type T | addable( T ) ) node { T data; struct( T ) node *next; };
    19 type List( type T ) = struct( T ) node *;
     18struct( otype T | addable( T ) ) node { T data; struct( T ) node *next; };
     19otype List( otype T ) = struct( T ) node *;
    2020List( int ) my_list;
    2121
    22 type Complex | addable( Complex );
     22otype Complex | addable( Complex );
    2323
    2424int main() {
  • src/Tests/Typedef.c

    r4c82a3c r55ba733  
    1818a c;
    1919
    20 typedef typeof(3) x, y;  // GCC
     20typedef otypeof(3) x, y;  // GCC
    2121
    2222x p;
     
    2424
    2525int main() {
    26     typedef typeof(3) z, p;
     26    typedef otypeof(3) z, p;
    2727    z w;
    2828    p x;
  • src/Tests/Typeof.c

    r4c82a3c r55ba733  
    11int main() {
    22    int *v1;
    3     typeof(v1) v2;
    4     typeof(*v1) v3[4];
     3    otypeof(v1) v2;
     4    otypeof(*v1) v3[4];
    55    char *v4[4];
    6     typeof(typeof(char *)[4]) v5;
    7     typeof (int *) v6;
    8     typeof( int ( int, int p ) ) *v7;
    9     typeof( [int] ( int, int p ) ) *v8;
     6    otypeof(otypeof(char *)[4]) v5;
     7    otypeof (int *) v6;
     8    otypeof( int ( int, int p ) ) *v7;
     9    otypeof( [int] ( int, int p ) ) *v8;
    1010}
Note: See TracChangeset for help on using the changeset viewer.