Changeset ee06e41b


Ignore:
Timestamp:
Feb 18, 2019, 1:04:30 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, persistent-indexer
Children:
d08beee
Parents:
ada4575
Message:

add char, signed char, unsigned char to basic types in prologue

Files:
7 edited

Legend:

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

    rada4575 ree06e41b  
     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 : Mon Feb 18 09:47:33 2019
     13// Update Count     : 22
     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 , },
     
    150165        cout << endl;
    151166
    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;
     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;
    155170        cout << "signed int !?( _Bool );" << endl;
    156171
     
    188203        cout << "// Arithmetic Constructors //" << endl;
    189204        cout << "/////////////////////////////" << endl;
     205        cout << endl;
     206
    190207        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 << " )";
     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 << ")";
    196213                }
    197214                cout << ";" << endl;
    198                 cout << "void \t^?{}( " << type << " & );" << endl;
     215                cout << "void ^?{}( " << type << " & );" << endl;
    199216        };
    200217
     
    202219        otype("one_t");
    203220        otype("_Bool", true);
    204         otype("char", true);
    205         otype("signed char", true);
    206         otype("unsigned char", true);
     221        cout << endl;
    207222
    208223        for (auto type : basicTypes) {
    209                 cout << "void  ?{}(" << type.name << " &);" << endl;
    210                 cout << "void  ?{}(" << type.name << " &, " << type.name << ");" << endl;
     224                cout << "void ?{}(" << type.name << " &);" << endl;
     225                cout << "void ?{}(" << type.name << " &, " << type.name << ");" << endl;
     226                cout << "void ?{}(" << type.name << " &, zero_t);" << endl;
    211227                cout << "void ^?{}(" << type.name << " &);" << endl;
    212228                cout << endl;
     
    217233        cout << "// Pointer Constructors //" << endl;
    218234        cout << "//////////////////////////" << endl;
    219         cout << "forall(ftype FT) void  ?{}( FT *&, FT * );" << endl;
    220         cout << "forall(ftype FT) void  ?{}( FT * volatile &, FT * );" << endl;
     235        cout << endl;
     236
     237        cout << "forall(ftype FT) void ?{}( FT *&, FT * );" << endl;
     238        cout << "forall(ftype FT) void ?{}( FT * volatile &, FT * );" << endl;
    221239
    222240        // generate qualifiers
     
    242260                for (auto cvq : qualifiersPair) {
    243261                        for (auto is_vol : { "        ", "volatile" }) {
    244                                 cout << "forall(dtype DT) void  ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
     262                                cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
    245263                        }
    246264                }
    247265                for (auto cvq : qualifiersSingle) {
    248266                        for (auto is_vol : { "        ", "volatile" }) {
    249                                 cout << "forall(dtype DT) void  ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
     267                                cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
    250268                        }
    251269                        for (auto is_vol : { "        ", "volatile" }) {
     
    386404        cout << endl;
    387405}
     406
     407// Local Variables: //
     408// tab-width: 4 //
     409// End: //
  • libcfa/src/containers/maybe.cfa

    rada4575 ree06e41b  
    1010// Created On       : Wed May 24 15:40:00 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 20 15:23:50 2017
    13 // Update Count     : 2
     12// Last Modified On : Sun Feb 17 11:22:03 2019
     13// Update Count     : 3
    1414//
    1515
     
    3939forall(otype T)
    4040maybe(T) ?=?(maybe(T) & this, maybe(T) that) {
    41         if (this.has_value & that.has_value) {
     41        if (this.has_value && that.has_value) {
    4242                this.value = that.value;
    4343        } else if (this.has_value) {
  • libcfa/src/containers/result.cfa

    rada4575 ree06e41b  
    1010// Created On       : Wed May 24 15:40:00 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 20 15:23:58 2017
    13 // Update Count     : 2
     12// Last Modified On : Sun Feb 17 11:24:04 2019
     13// Update Count     : 3
    1414//
    1515
     
    4848forall(otype T, otype E)
    4949result(T, E) ?=?(result(T, E) & this, result(T, E) that) {
    50         if (this.has_value & that.has_value) {
     50        if (this.has_value && that.has_value) {
    5151                this.value = that.value;
    5252        } else if (this.has_value) {
  • tests/.expect/declarationSpecifier.x64.txt

    rada4575 ree06e41b  
    689689signed int _X4mainFi_iPPKc__1(signed int _X4argci_1, const char **_X4argvPPKc_1){
    690690    __attribute__ ((unused)) signed int _X12_retval_maini_1;
    691     ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
     691    ((void)(_X12_retval_maini_1=0) /* ?{} */);
    692692    return _X12_retval_maini_1;
    693693    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/gccExtensions.x64.txt

    rada4575 ree06e41b  
    162162    signed int _X2m2A0A0i_2[((unsigned long int )10)][((unsigned long int )10)];
    163163    signed int _X2m3A0A0i_2[((unsigned long int )10)][((unsigned long int )10)];
    164     ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
     164    ((void)(_X12_retval_maini_1=0) /* ?{} */);
    165165    return _X12_retval_maini_1;
    166166    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/sum.txt

    rada4575 ree06e41b  
     1sum from 5 to 15 is 95, check 95
     2sum from 5 to 15 is 95, check 95
    13sum from 5 to 15 is 95, check 95
    24sum from 5 to 15 is 95, check 95
  • tests/sum.cfa

    rada4575 ree06e41b  
    1111// Created On       : Wed May 27 17:56:53 2015
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Sat Feb  9 15:38:48 2019
    14 // Update Count     : 293
     13// Last Modified On : Sun Feb 17 22:54:16 2019
     14// Update Count     : 328
    1515//
    1616
     
    3434} // sum
    3535
    36 // Not in prelude.
    37 unsigned char ?+?( unsigned char t1, unsigned char t2 ) { return (int)t1 + t2; } // cast forces integer addition, otherwise recursion
    38 unsigned char ?+=?( unsigned char & t1, unsigned char t2 ) { t1 = t1 + t2; return t1; }
    39 unsigned char ++?( unsigned char & t ) { t += 1; return t; }
    40 unsigned char ?++( unsigned char & t ) { unsigned char temp = t; t += 1; return temp; }
    41 
    42 // Not in prelude.
    43 void ?{}( unsigned char & c, zero_t ) { c = 0; }
    44 void ?{}( int & i, zero_t ) { i = 0; }
    45 void ?{}( float & f, zero_t ) { f = 0.0; }
    46 void ?{}( double & d, zero_t ) { d = 0.0; }
    47 
    4836int main( void ) {
    4937        const int low = 5, High = 15, size = High - low;
    5038
    51         unsigned char s = 0, a[size], v = (char)low;
    52         for ( int i = 0; i < size; i += 1, v += 1 ) {
     39        signed char s = 0, a[size], v = (char)low;
     40        for ( int i = 0; i < size; i += 1, v += 1hh ) {
    5341                s += v;
    5442                a[i] = v;
    5543        } // for
    5644        sout | "sum from" | low | "to" | High | "is"
    57                  | sum( size, (unsigned char *)a ) | ", check" | (int)s;
     45                 | sum( size, (signed char *)a ) | ", check" | (int)s;
     46
     47        unsigned char s = 0, a[size], v = low;
     48        for ( int i = 0; i < size; i += 1, v += 1hhu ) {
     49                s += (unsigned char)v;
     50                a[i] = (unsigned char)v;
     51        } // for
     52        sout | "sum from" | low | "to" | High | "is"
     53                 | sum( size, (unsigned char *)a ) | ", check" | (unsigned char)s;
     54
     55        short int s = 0, a[size], v = low;
     56        for ( int i = 0; i < size; i += 1, v += 1h ) {
     57                s += (short int)v;
     58                a[i] = (short int)v;
     59        } // for
     60        sout | "sum from" | low | "to" | High | "is"
     61                 | sum( size, (short int *)a ) | ", check" | (short int)s;
    5862
    5963        int s = 0, a[size], v = low;
Note: See TracChangeset for help on using the changeset viewer.