Ignore:
Timestamp:
Jan 19, 2021, 8:44:29 PM (3 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
dafbde8
Parents:
2f47ea4
Message:

Converting the project to use the new syntax for otype, dtype and ttytpe.

Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r2f47ea4 rfd54fef  
    3636
    3737
    38 forall( dtype ostype | ostream( ostype ) ) {
     38forall( ostype & | ostream( ostype ) ) {
    3939        ostype & ?|?( ostype & os, bool b ) {
    4040                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     
    402402
    403403// tuples
    404 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
     404forall( ostype &, T, Params... | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
    405405        ostype & ?|?( ostype & os, T arg, Params rest ) {
    406406                (ostype &)(os | arg);                                                   // print first argument
     
    421421
    422422// writes the range [begin, end) to the given stream
    423 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) ) {
     423forall( ostype &, elt_type | writeable( elt_type, ostype ), iterator_type | iterator( iterator_type, elt_type ) ) {
    424424        void write( iterator_type begin, iterator_type end, ostype & os ) {
    425425                void print( elt_type i ) { os | i; }
     
    442442// Default prefix for non-decimal prints is 0b, 0, 0x.
    443443#define IntegralFMTImpl( T, IFMTNP, IFMTP ) \
    444 forall( dtype ostype | ostream( ostype ) ) { \
     444forall( ostype & | ostream( ostype ) ) { \
    445445        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    446446                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
     
    535535// Default prefix for non-decimal prints is 0b, 0, 0x.
    536536#define IntegralFMTImpl128( T, SIGNED, CODE, IFMTNP, IFMTP ) \
    537 forall( dtype ostype | ostream( ostype ) ) \
     537forall( ostype & | ostream( ostype ) ) \
    538538static void base10_128( ostype & os, _Ostream_Manip(T) f ) { \
    539539        if ( f.val > UINT64_MAX ) { \
     
    552552        } /* if */ \
    553553} /* base10_128 */ \
    554 forall( dtype ostype | ostream( ostype ) ) { \
     554forall( ostype & | ostream( ostype ) ) { \
    555555        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    556556                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
     
    654654#if defined( __SIZEOF_INT128__ )
    655655// Default prefix for non-decimal prints is 0b, 0, 0x.
    656 forall( dtype ostype | ostream( ostype ) )
     656forall( ostype & | ostream( ostype ) )
    657657static inline void base_128( ostype & os, unsigned int128 val, unsigned int128 power, _Ostream_Manip(uint64_t) & f, unsigned int maxdig, unsigned int bits, unsigned int cnt = 0 ) {
    658658        int wd = 1;                                                                                     // f.wd is never 0 because 0 implies left-pad
     
    719719
    720720#define IntegralFMTImpl128( T ) \
    721 forall( dtype ostype | ostream( ostype ) ) { \
     721forall( ostype & | ostream( ostype ) ) { \
    722722        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    723723                _Ostream_Manip(uint64_t) fmt; \
     
    767767
    768768#define FloatingPointFMTImpl( T, DFMTNP, DFMTP ) \
    769 forall( dtype ostype | ostream( ostype ) ) { \
     769forall( ostype & | ostream( ostype ) ) { \
    770770        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    771771                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
     
    801801// *********************************** character ***********************************
    802802
    803 forall( dtype ostype | ostream( ostype ) ) {
     803forall( ostype & | ostream( ostype ) ) {
    804804        ostype & ?|?( ostype & os, _Ostream_Manip(char) f ) {
    805805                if ( f.base != 'c' ) {                                                  // bespoke binary/octal/hex format
     
    834834// *********************************** C string ***********************************
    835835
    836 forall( dtype ostype | ostream( ostype ) ) {
     836forall( ostype & | ostream( ostype ) ) {
    837837        ostype & ?|?( ostype & os, _Ostream_Manip(const char *) f ) {
    838838                if ( ! f.val ) return os;                                               // null pointer ?
     
    882882
    883883
    884 forall( dtype istype | istream( istype ) ) {
     884forall( istype & | istream( istype ) ) {
    885885        istype & ?|?( istype & is, bool & b ) {
    886886                char val[6];
     
    10481048// *********************************** manipulators ***********************************
    10491049
    1050 forall( dtype istype | istream( istype ) )
     1050forall( istype & | istream( istype ) )
    10511051istype & ?|?( istype & is, _Istream_Cstr f ) {
    10521052        // skip xxx
     
    10831083} // ?|?
    10841084
    1085 forall( dtype istype | istream( istype ) )
     1085forall( istype & | istream( istype ) )
    10861086istype & ?|?( istype & is, _Istream_Char f ) {
    10871087        fmt( is, "%*c" );                                                                       // argument variable unused
     
    10901090
    10911091#define InputFMTImpl( T, CODE ) \
    1092 forall( dtype istype | istream( istype ) ) \
     1092forall( istype & | istream( istype ) ) \
    10931093istype & ?|?( istype & is, _Istream_Manip(T) f ) { \
    10941094        enum { size = 16 }; \
     
    11191119InputFMTImpl( long double, "Lf" )
    11201120
    1121 forall( dtype istype | istream( istype ) )
     1121forall( istype & | istream( istype ) )
    11221122istype & ?|?( istype & is, _Istream_Manip(float _Complex) fc ) {
    11231123        float re, im;
     
    11301130} // ?|?
    11311131
    1132 forall( dtype istype | istream( istype ) )
     1132forall( istype & | istream( istype ) )
    11331133istype & ?|?( istype & is, _Istream_Manip(double _Complex) dc ) {
    11341134        double re, im;
     
    11411141} // ?|?
    11421142
    1143 forall( dtype istype | istream( istype ) )
     1143forall( istype & | istream( istype ) )
    11441144istype & ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) {
    11451145        long double re, im;
Note: See TracChangeset for help on using the changeset viewer.