Ignore:
Timestamp:
Jul 7, 2017, 10:39:08 AM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
29038ef
Parents:
52a9004
Message:

change meaning of sepOn, and replace #if with #pragma once in include files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/rational

    r52a9004 r53a6c2a  
    1212// Created On       : Wed Apr  6 17:56:25 2016
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Mon May 15 21:30:12 2017
    15 // Update Count     : 90
     14// Last Modified On : Fri Jul  7 09:34:33 2017
     15// Update Count     : 93
    1616//
    1717
    18 #ifndef RATIONAL_H
    19 #define RATIONAL_H
     18#pragma once
    2019
    2120#include "iostream"
     
    4746// implementation
    4847
    49 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     48forall( otype RationalImpl | arithmetic( RationalImpl ) )
    5049struct Rational {
    5150        RationalImpl numerator, denominator;                            // invariant: denominator > 0
     
    5453// constructors
    5554
    56 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     55forall( otype RationalImpl | arithmetic( RationalImpl ) )
    5756void ?{}( Rational(RationalImpl) * r );
    5857
    59 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     58forall( otype RationalImpl | arithmetic( RationalImpl ) )
    6059void ?{}( Rational(RationalImpl) * r, RationalImpl n );
    6160
    62 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     61forall( otype RationalImpl | arithmetic( RationalImpl ) )
    6362void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d );
    6463
    65 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     64forall( otype RationalImpl | arithmetic( RationalImpl ) )
    6665void ?{}( Rational(RationalImpl) * r, zero_t );
    6766
    68 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     67forall( otype RationalImpl | arithmetic( RationalImpl ) )
    6968void ?{}( Rational(RationalImpl) * r, one_t );
    7069
    71 // getter for numerator/denominator
     70// numerator/denominator getter
    7271
    73 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     72forall( otype RationalImpl | arithmetic( RationalImpl ) )
    7473RationalImpl numerator( Rational(RationalImpl) r );
    7574
    76 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     75forall( otype RationalImpl | arithmetic( RationalImpl ) )
    7776RationalImpl denominator( Rational(RationalImpl) r );
    78 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     77
     78forall( otype RationalImpl | arithmetic( RationalImpl ) )
    7979[ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src );
    8080
    81 // setter for numerator/denominator
     81// numerator/denominator setter
    8282
    83 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     83forall( otype RationalImpl | arithmetic( RationalImpl ) )
    8484RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n );
    8585
    86 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     86forall( otype RationalImpl | arithmetic( RationalImpl ) )
    8787RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d );
    8888
    8989// comparison
    9090
    91 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     91forall( otype RationalImpl | arithmetic( RationalImpl ) )
    9292int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    9393
    94 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     94forall( otype RationalImpl | arithmetic( RationalImpl ) )
    9595int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    9696
    97 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     97forall( otype RationalImpl | arithmetic( RationalImpl ) )
    9898int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    9999
    100 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     100forall( otype RationalImpl | arithmetic( RationalImpl ) )
    101101int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    102102
    103 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     103forall( otype RationalImpl | arithmetic( RationalImpl ) )
    104104int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    105105
    106 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     106forall( otype RationalImpl | arithmetic( RationalImpl ) )
    107107int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    108108
    109109// arithmetic
    110110
    111 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     111forall( otype RationalImpl | arithmetic( RationalImpl ) )
    112112Rational(RationalImpl) +?( Rational(RationalImpl) r );
    113113
    114 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     114forall( otype RationalImpl | arithmetic( RationalImpl ) )
    115115Rational(RationalImpl) -?( Rational(RationalImpl) r );
    116116
    117 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     117forall( otype RationalImpl | arithmetic( RationalImpl ) )
    118118Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    119119
    120 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     120forall( otype RationalImpl | arithmetic( RationalImpl ) )
    121121Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    122122
    123 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     123forall( otype RationalImpl | arithmetic( RationalImpl ) )
    124124Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    125125
    126 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     126forall( otype RationalImpl | arithmetic( RationalImpl ) )
    127127Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    128128
    129129// conversion
    130 forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
     130forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
    131131double widen( Rational(RationalImpl) r );
    132 forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl );  RationalImpl convert( double );} )
     132forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl );  RationalImpl convert( double );} )
    133133Rational(RationalImpl) narrow( double f, RationalImpl md );
    134134
    135135// I/O
    136 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     136forall( otype RationalImpl | arithmetic( RationalImpl ) )
    137137forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } )
    138138istype * ?|?( istype *, Rational(RationalImpl) * );
    139139
    140 forall ( otype RationalImpl | arithmetic( RationalImpl ) )
     140forall( otype RationalImpl | arithmetic( RationalImpl ) )
    141141forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } )
    142142ostype * ?|?( ostype *, Rational(RationalImpl ) );
    143 
    144 #endif // RATIONAL_H
    145143
    146144// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.