Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/prelude-gen.cc

    rb830e046 re523b07  
    1 //
    2 // Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
    3 //
    4 // The contents of this file are covered under the licence agreement in the
    5 // file "LICENCE" distributed with Cforall.
    6 //
    7 // prelude-gen.cc --
    8 //
    9 // Author           : Rob Schluntz and Thierry Delisle
    10 // Created On       : Sat Feb 16 08:44:58 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  8 16:00:22 2019
    13 // Update Count     : 26
    14 //
    15 
    161#include <algorithm>
    172#include <array>
     
    2611        bool hasComparison;
    2712} basicTypes[] = {
    28         { "char"                  , false, true , },
    29         { "signed char"           , false, true , },
    30         { "unsigned char"         , false, true , },
     13        // { "char"                  , false, true , },
     14        // { "signed char"           , false, true , },
     15        // { "unsigned char"         , false, true , },
    3116        { "signed short"          , false, true , },
    3217        { "unsigned short"        , false, true , },
     
    4934#if defined(__i386__) || defined(__ia64__) || defined(__x86_64__)
    5035        { "__float80"             , true , true , },
    51         { "__float128"            , true , true , },
     36        { "_Float128"             , true , true , },
    5237#endif
    5338};
     
    165150        cout << endl;
    166151
    167         cout << "signed int ?==?( zero_t, zero_t ),     ?!=?( zero_t, zero_t );" << endl;
    168         cout << "signed int ?==?( one_t, one_t ),       ?!=?( one_t, one_t );" << endl;
    169         cout << "signed int ?==?( _Bool, _Bool ),       ?!=?( _Bool, _Bool );" << endl;
    170         cout << "signed int !?( _Bool );" << endl;
     152        cout << "signed int ?==?( zero_t, zero_t ),                                                     ?!=?( zero_t, zero_t );" << endl;
     153        cout << "signed int ?==?( one_t, one_t ),                                                       ?!=?( one_t, one_t );" << endl;
     154        cout << "signed int ?==?( _Bool, _Bool ),                                                       ?!=?( _Bool, _Bool );" << endl;
     155        cout << "signed int     !?( _Bool );" << endl;
    171156
    172157        for (auto op : arithmeticOperators) {
     
    203188        cout << "// Arithmetic Constructors //" << endl;
    204189        cout << "/////////////////////////////" << endl;
    205         cout << endl;
    206 
    207190        auto otype = [](const std::string & type, bool do_volatile = false) {
    208                 cout << "void ?{} (" << type << " &);" << endl;
    209                 cout << "void ?{} (" << type << " &, " << type << ");" << endl;
    210                 cout << type << "  ?=? (" << type << " &, " << type << ")";
    211                 if ( do_volatile ) {
    212                         cout << ",  ?=?(volatile " << type << " &, " << type << ")";
     191                cout << "void \t?{} ( " << type << " & );" << endl;
     192                cout << "void \t?{} ( " << type << " &, " << type << " );" << endl;
     193                cout << type << " \t?=? ( " << type << " &, " << type << " )";
     194                if( do_volatile ) {
     195                        cout << ", \t?=?( volatile " << type << " &, " << type << " )";
    213196                }
    214197                cout << ";" << endl;
    215                 cout << "void ^?{}( " << type << " & );" << endl;
     198                cout << "void \t^?{}( " << type << " & );" << endl;
    216199        };
    217200
     
    219202        otype("one_t");
    220203        otype("_Bool", true);
    221         cout << endl;
     204        otype("char", true);
     205        otype("signed char", true);
     206        otype("unsigned char", true);
    222207
    223208        for (auto type : basicTypes) {
    224                 cout << "void ?{}(" << type.name << " &);" << endl;
    225                 cout << "void ?{}(" << type.name << " &, " << type.name << ");" << endl;
    226                 cout << "void ?{}(" << type.name << " &, zero_t);" << endl;
     209                cout << "void  ?{}(" << type.name << " &);" << endl;
     210                cout << "void  ?{}(" << type.name << " &, " << type.name << ");" << endl;
    227211                cout << "void ^?{}(" << type.name << " &);" << endl;
    228212                cout << endl;
     
    233217        cout << "// Pointer Constructors //" << endl;
    234218        cout << "//////////////////////////" << endl;
    235         cout << endl;
    236 
    237         cout << "forall(ftype FT) void ?{}( FT *&, FT * );" << endl;
    238         cout << "forall(ftype FT) void ?{}( FT * volatile &, FT * );" << endl;
     219        cout << "forall(ftype FT) void  ?{}( FT *&, FT * );" << endl;
     220        cout << "forall(ftype FT) void  ?{}( FT * volatile &, FT * );" << endl;
    239221
    240222        // generate qualifiers
     
    260242                for (auto cvq : qualifiersPair) {
    261243                        for (auto is_vol : { "        ", "volatile" }) {
    262                                 cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
     244                                cout << "forall(dtype DT) void  ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
    263245                        }
    264246                }
    265247                for (auto cvq : qualifiersSingle) {
    266248                        for (auto is_vol : { "        ", "volatile" }) {
    267                                 cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
     249                                cout << "forall(dtype DT) void  ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
    268250                        }
    269251                        for (auto is_vol : { "        ", "volatile" }) {
     
    287269        cout << "forall(ftype FT) FT *                  ?=?( FT *          &, zero_t );" << endl;
    288270        cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, zero_t );" << endl;
    289         cout << "forall(ftype FT) void  ?{}( FT *          & );" << endl;
    290         cout << "forall(ftype FT) void  ^?{}( FT *         & );" << endl;
     271        cout << "forall( ftype FT ) void        ?{}( FT *          & );" << endl;
     272        cout << "forall( ftype FT ) void        ^?{}( FT *         & );" << endl;
    291273        cout << endl;
    292274
     
    295277        cout << "///////////////////////" << endl;
    296278
    297         cout << "forall(ftype FT) FT *                  ?=?( FT *&, FT * );" << endl;
    298         cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, FT * );" << endl;
    299         cout << "forall(ftype FT) int !?( FT * );" << endl;
    300         cout << "forall(ftype FT) signed int ?==?( FT *, FT * );" << endl;
    301         cout << "forall(ftype FT) signed int ?!=?( FT *, FT * );" << endl;
    302         cout << "forall(ftype FT) FT &           *?( FT * );" << endl;
     279        cout << "forall( ftype FT ) FT *                        ?=?( FT *&, FT * );" << endl;
     280        cout << "forall( ftype FT ) FT *                        ?=?( FT * volatile &, FT * );" << endl;
     281        cout << "forall( ftype FT ) int !?( FT * );" << endl;
     282        cout << "forall( ftype FT ) signed int ?==?( FT *, FT * );" << endl;
     283        cout << "forall( ftype FT ) signed int ?!=?( FT *, FT * );" << endl;
     284        cout << "forall( ftype FT ) FT &                 *?( FT * );" << endl;
     285
    303286
    304287        for (auto op : pointerOperators) {
     
    404387}
    405388
    406 // Local Variables: //
    407 // tab-width: 4 //
    408 // End: //
Note: See TracChangeset for help on using the changeset viewer.