Ignore:
File:
1 edited

Legend:

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

    re523b07 rc41c18a6  
     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
    116#include <algorithm>
    217#include <array>
     
    1126        bool hasComparison;
    1227} basicTypes[] = {
    13         // { "char"                  , false, true , },
    14         // { "signed char"           , false, true , },
    15         // { "unsigned char"         , false, true , },
     28        { "char"                  , false, true , },
     29        { "signed char"           , false, true , },
     30        { "unsigned char"         , false, true , },
    1631        { "signed short"          , false, true , },
    1732        { "unsigned short"        , false, true , },
     
    3449#if defined(__i386__) || defined(__ia64__) || defined(__x86_64__)
    3550        { "__float80"             , true , true , },
    36         { "_Float128"             , true , true , },
     51        { "__float128"            , true , true , },
    3752#endif
    3853};
     
    103118        { "?!=?", false, "signed int", Normal, "" },
    104119        { "?=?", true, "", Normal, "" }, // void * LHS, zero_t RHS ???
    105         { "*?", false, "&", Normal, " | sized(DT)" }, // & ???
     120//      { "*?", false, "&", Normal, " | sized(DT)" }, // & ???
     121        { "*?", false, "&", Normal, "" }, // & ???
    106122
    107123        { "?-?", false, "ptrdiff_t", Normal, " | sized(DT)" },
     
    150166        cout << endl;
    151167
    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;
     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;
    156172
    157173        for (auto op : arithmeticOperators) {
     
    188204        cout << "// Arithmetic Constructors //" << endl;
    189205        cout << "/////////////////////////////" << endl;
     206        cout << endl;
     207
    190208        auto otype = [](const std::string & type, bool do_volatile = false) {
    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 << " )";
     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 << ")";
    196214                }
    197215                cout << ";" << endl;
    198                 cout << "void \t^?{}( " << type << " & );" << endl;
     216                cout << "void ^?{}( " << type << " & );" << endl;
    199217        };
    200218
    201219        otype("zero_t");
     220        cout << endl;
    202221        otype("one_t");
     222        cout << endl;
    203223        otype("_Bool", true);
    204         otype("char", true);
    205         otype("signed char", true);
    206         otype("unsigned char", true);
     224        cout << endl;
    207225
    208226        for (auto type : basicTypes) {
    209                 cout << "void  ?{}(" << type.name << " &);" << endl;
    210                 cout << "void  ?{}(" << type.name << " &, " << type.name << ");" << endl;
     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;
    211231                cout << "void ^?{}(" << type.name << " &);" << endl;
    212232                cout << endl;
     
    217237        cout << "// Pointer Constructors //" << endl;
    218238        cout << "//////////////////////////" << endl;
    219         cout << "forall(ftype FT) void  ?{}( FT *&, FT * );" << endl;
    220         cout << "forall(ftype FT) void  ?{}( FT * volatile &, FT * );" << endl;
     239        cout << endl;
     240
     241        cout << "forall(ftype FT) void ?{}( FT *&, FT * );" << endl;
     242        cout << "forall(ftype FT) void ?{}( FT * volatile &, FT * );" << endl;
    221243
    222244        // generate qualifiers
     
    242264                for (auto cvq : qualifiersPair) {
    243265                        for (auto is_vol : { "        ", "volatile" }) {
    244                                 cout << "forall(dtype DT) void  ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
     266                                cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
    245267                        }
    246268                }
    247269                for (auto cvq : qualifiersSingle) {
    248270                        for (auto is_vol : { "        ", "volatile" }) {
    249                                 cout << "forall(dtype DT) void  ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
     271                                cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
    250272                        }
    251273                        for (auto is_vol : { "        ", "volatile" }) {
     
    269291        cout << "forall(ftype FT) FT *                  ?=?( FT *          &, zero_t );" << endl;
    270292        cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, zero_t );" << endl;
    271         cout << "forall( ftype FT ) void        ?{}( FT *          & );" << endl;
    272         cout << "forall( ftype FT ) void        ^?{}( FT *         & );" << endl;
     293        cout << "forall(ftype FT) void  ?{}( FT *          & );" << endl;
     294        cout << "forall(ftype FT) void  ^?{}( FT *         & );" << endl;
    273295        cout << endl;
    274296
     
    277299        cout << "///////////////////////" << endl;
    278300
    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 
     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;
    286307
    287308        for (auto op : pointerOperators) {
     
    387408}
    388409
     410// Local Variables: //
     411// tab-width: 4 //
     412// End: //
Note: See TracChangeset for help on using the changeset viewer.