Ignore:
File:
1 edited

Legend:

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

    rc41c18a6 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 : Tue Apr  2 17:18:24 2019
    13 // Update Count     : 37
    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};
     
    118103        { "?!=?", false, "signed int", Normal, "" },
    119104        { "?=?", true, "", Normal, "" }, // void * LHS, zero_t RHS ???
    120 //      { "*?", false, "&", Normal, " | sized(DT)" }, // & ???
    121         { "*?", false, "&", Normal, "" }, // & ???
     105        { "*?", false, "&", Normal, " | sized(DT)" }, // & ???
    122106
    123107        { "?-?", false, "ptrdiff_t", Normal, " | sized(DT)" },
     
    166150        cout << endl;
    167151
    168         cout << "signed int ?==?( zero_t, zero_t ),     ?!=?( zero_t, zero_t );" << endl;
    169         cout << "signed int ?==?( one_t, one_t ),       ?!=?( one_t, one_t );" << endl;
    170         cout << "signed int ?==?( _Bool, _Bool ),       ?!=?( _Bool, _Bool );" << endl;
    171         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;
    172156
    173157        for (auto op : arithmeticOperators) {
     
    204188        cout << "// Arithmetic Constructors //" << endl;
    205189        cout << "/////////////////////////////" << endl;
    206         cout << endl;
    207 
    208190        auto otype = [](const std::string & type, bool do_volatile = false) {
    209                 cout << "void ?{} (" << type << " &);" << endl;
    210                 cout << "void ?{} (" << type << " &, " << type << ");" << endl;
    211                 cout << type << " ?=? (" << type << " &, " << type << ")";
    212                 if ( do_volatile ) {
    213                         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 << " )";
    214196                }
    215197                cout << ";" << endl;
    216                 cout << "void ^?{}( " << type << " & );" << endl;
     198                cout << "void \t^?{}( " << type << " & );" << endl;
    217199        };
    218200
    219201        otype("zero_t");
    220         cout << endl;
    221202        otype("one_t");
    222         cout << endl;
    223203        otype("_Bool", true);
    224         cout << endl;
     204        otype("char", true);
     205        otype("signed char", true);
     206        otype("unsigned char", true);
    225207
    226208        for (auto type : basicTypes) {
    227                 cout << "void ?{}(" << type.name << " &);" << endl;
    228                 cout << "void ?{}(" << type.name << " &, " << type.name << ");" << endl;
    229                 cout << "void ?{}(" << type.name << " &, zero_t);" << endl;
    230                 cout << "void ?{}(" << type.name << " &, one_t);" << endl;
     209                cout << "void  ?{}(" << type.name << " &);" << endl;
     210                cout << "void  ?{}(" << type.name << " &, " << type.name << ");" << endl;
    231211                cout << "void ^?{}(" << type.name << " &);" << endl;
    232212                cout << endl;
     
    237217        cout << "// Pointer Constructors //" << endl;
    238218        cout << "//////////////////////////" << endl;
    239         cout << endl;
    240 
    241         cout << "forall(ftype FT) void ?{}( FT *&, FT * );" << endl;
    242         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;
    243221
    244222        // generate qualifiers
     
    264242                for (auto cvq : qualifiersPair) {
    265243                        for (auto is_vol : { "        ", "volatile" }) {
    266                                 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;
    267245                        }
    268246                }
    269247                for (auto cvq : qualifiersSingle) {
    270248                        for (auto is_vol : { "        ", "volatile" }) {
    271                                 cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
     249                                cout << "forall(dtype DT) void  ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
    272250                        }
    273251                        for (auto is_vol : { "        ", "volatile" }) {
     
    291269        cout << "forall(ftype FT) FT *                  ?=?( FT *          &, zero_t );" << endl;
    292270        cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, zero_t );" << endl;
    293         cout << "forall(ftype FT) void  ?{}( FT *          & );" << endl;
    294         cout << "forall(ftype FT) void  ^?{}( FT *         & );" << endl;
     271        cout << "forall( ftype FT ) void        ?{}( FT *          & );" << endl;
     272        cout << "forall( ftype FT ) void        ^?{}( FT *         & );" << endl;
    295273        cout << endl;
    296274
     
    299277        cout << "///////////////////////" << endl;
    300278
    301         cout << "forall(ftype FT) FT *                  ?=?( FT *&, FT * );" << endl;
    302         cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, FT * );" << endl;
    303         cout << "forall(ftype FT) int !?( FT * );" << endl;
    304         cout << "forall(ftype FT) signed int ?==?( FT *, FT * );" << endl;
    305         cout << "forall(ftype FT) signed int ?!=?( FT *, FT * );" << endl;
    306         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
    307286
    308287        for (auto op : pointerOperators) {
     
    408387}
    409388
    410 // Local Variables: //
    411 // tab-width: 4 //
    412 // End: //
Note: See TracChangeset for help on using the changeset viewer.