Changeset 37f0da8 for src/libcfa


Ignore:
Timestamp:
Apr 14, 2016, 3:23:53 PM (10 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
0f9e4403, 347c42f, 70a06f6
Parents:
37218fc (diff), baba5d8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

Location:
src/libcfa
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/iostream

    r37218fc r37f0da8  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr  5 22:32:37 2016
    13 // Update Count     : 90
     12// Last Modified On : Sun Apr 10 23:00:12 2016
     13// Update Count     : 92
    1414//
    1515
     
    2020
    2121trait ostream( dtype ostype ) {
    22         _Bool sepPrt( ostype * );
    23         void sepOn( ostype * );
    24         void sepOff( ostype * );
    25         void sepReset( ostype * );
    26         void sepReset( ostype *, _Bool );
    27         void sepSet( ostype *, const char * );
    28         const char * sepGet( ostype * );
    29         _Bool sepDisable( ostype * );
    30         _Bool sepEnable( ostype * );
     22        _Bool sepPrt( ostype * );                                                       // return separator state (on/off)
     23        void sepOn( ostype * );                                                         // turn separator state on
     24        void sepOff( ostype * );                                                        // turn separator state off
     25        void sepReset( ostype * );                                                      // set separator state to default state
     26        void sepReset( ostype *, _Bool );                                       // set separator and default state
     27        void sepSet( ostype *, const char * );                          // set separator to string (15 character maximum)
     28        const char * sepGet( ostype * );                                        // get separator string
     29        _Bool sepDisable( ostype * );                                           // set default state to off, and return previous state
     30        _Bool sepEnable( ostype * );                                            // set default state to on, and return previous state
     31
    3132        int fail( ostype * );
    3233        int flush( ostype * );
  • src/libcfa/rational.c

    r37218fc r37f0da8  
    1111// Created On       : Wed Apr  6 17:54:28 2016
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Fri Apr  8 17:35:05 2016
    14 // Update Count     : 18
     13// Last Modified On : Tue Apr 12 21:26:42 2016
     14// Update Count     : 21
    1515//
    1616
     
    1919#include "stdlib"
    2020
    21 extern "C" {
    22 #include <stdlib.h>                                                                             // exit
    23 } // extern
    24 
    2521
    2622// constants
     
    3026
    3127
    32 // helper
     28// helper routines
    3329
    3430// Calculate greatest common denominator of two numbers, the first of which may be negative. Used to reduce rationals.
     31// alternative: https://en.wikipedia.org/wiki/Binary_GCD_algorithm
    3532static long int gcd( long int a, long int b ) {
    3633    for ( ;; ) {                                                                                // Euclid's algorithm
  • src/libcfa/stdlib

    r37218fc r37f0da8  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Apr  1 22:26:14 2016
    13 // Update Count     : 73
     12// Last Modified On : Wed Apr 13 14:45:53 2016
     13// Update Count     : 85
    1414//
    1515
     
    1818extern "C" {
    1919#include <stddef.h>                                                                             // size_t
    20 #include <math.h>                                                                               // floor
    2120} // extern "C"
    2221
     22//---------------------------------------
     23
     24extern "C" {
     25#ifndef EXIT_FAILURE
     26#define EXIT_FAILURE    1                                                               // failing exit status
     27#define EXIT_SUCCESS    0                                                               // successful exit status
     28#endif // ! EXIT_FAILURE
     29void exit( int rc );
     30} // extern "C"
     31
     32//---------------------------------------
     33
     34extern "C" {
     35void * malloc( size_t );                                                                // use default C routine for void *
     36} // extern "C"
    2337forall( otype T ) T * malloc( void );
    2438forall( otype T ) T * malloc( char fill );
    2539forall( otype T ) T * malloc( T * ptr, size_t size );
    2640forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
    27 forall( otype T ) T * calloc( size_t size );
     41extern "C" {
     42void * calloc( size_t nmemb, size_t size );                             // use default C routine for void *
     43} // extern "C"
     44forall( otype T ) T * calloc( size_t nmemb );
     45extern "C" {
     46void * realloc( void * ptr, size_t size );                              // use default C routine for void *
     47} // extern "C"
    2848forall( otype T ) T * realloc( T * ptr, size_t size );
    2949forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
     
    81101char abs( char );
    82102extern "C" {
    83 int abs( int );                         // use default C routine for int
     103int abs( int );                                                                                 // use default C routine for int
    84104} // extern "C"
    85105long int abs( long int );
     
    96116float floor( float );
    97117extern "C" {
    98 double floor( double );         // use C routine for double
     118double floor( double );                                                                 // use C routine for double
    99119} // extern "C"
    100120long double floor( long double );
     
    102122float ceil( float );
    103123extern "C" {
    104 double ceil( double );          // use C routine for double
     124double ceil( double );                                                                  // use C routine for double
    105125} // extern "C"
    106126long double ceil( long double );
  • src/libcfa/stdlib.c

    r37218fc r37f0da8  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 30 10:48:41 2016
    13 // Update Count     : 149
     12// Last Modified On : Wed Apr 13 14:49:58 2016
     13// Update Count     : 155
    1414//
    1515
     
    2828
    2929forall( otype T ) T * malloc( void ) {
    30         printf( "malloc1\n" );
     30        //printf( "malloc1\n" );
    3131    return (T *)malloc( sizeof(T) );
    3232} // malloc
    33 forall( otype T ) T * malloc( size_t size ) {
    34         printf( "malloc2\n" );
    35     return (T *)(void *)malloc( size );
    36 } // malloc
    3733forall( otype T ) T * malloc( char fill ) {
    38         printf( "malloc3\n" );
     34        //printf( "malloc3\n" );
    3935        T * ptr = (T *)malloc( sizeof(T) );
    4036    return memset( ptr );
    4137} // malloc
    4238
    43 forall( otype T ) T * calloc( size_t size ) {
    44         printf( "calloc\n" );
    45     return (T *)calloc( size, sizeof(T) );
     39forall( otype T ) T * calloc( size_t nmemb ) {
     40        //printf( "calloc\n" );
     41    return (T *)calloc( nmemb, sizeof(T) );
    4642} // calloc
    4743
    4844forall( otype T ) T * realloc( T * ptr, size_t size ) {
    49         printf( "realloc1\n" );
     45        //printf( "realloc1\n" );
    5046    return (T *)(void *)realloc( (void *)ptr, size );
    5147} // realloc
    5248forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill ) {
    53         printf( "realloc2\n" );
     49        //printf( "realloc2\n" );
    5450    char * nptr = (T *)(void *)realloc( (void *)ptr, size );
    5551    size_t unused = malloc_usable_size( nptr );
     
    5955
    6056forall( otype T ) T * malloc( T * ptr, size_t size ) {
    61         printf( "malloc4\n" );
     57        //printf( "malloc4\n" );
    6258    return (T *)realloc( ptr, size );
    6359} // malloc
    6460forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill ) {
    65         printf( "malloc5\n" );
     61        //printf( "malloc5\n" );
    6662    return (T *)realloc( ptr, size, fill );
    6763} // malloc
    6864
    6965forall( otype T ) T * aligned_alloc( size_t alignment ) {
    70         printf( "aligned_alloc\n" );
     66        //printf( "aligned_alloc\n" );
    7167    return (T *)memalign( alignment, sizeof(T) );
    7268} // aligned_alloc
    7369
    7470forall( otype T ) T * memalign( size_t alignment ) {
    75         printf( "memalign\n" );
     71        //printf( "memalign\n" );
    7672    return (T *)memalign( alignment, sizeof(T) );
    7773} // memalign
    7874
    7975forall( otype T ) int posix_memalign( T ** ptr, size_t alignment ) {
    80         printf( "posix_memalign\n" );
     76        //printf( "posix_memalign\n" );
    8177    return posix_memalign( (void **)ptr, alignment, sizeof(T) );
    8278} // posix_memalign
    8379
    8480forall( otype T ) T * memset( T * ptr, unsigned char fill ) { // use default value '\0' for fill
    85         printf( "memset1\n" );
     81        //printf( "memset1\n" );
    8682    return (T *)memset( ptr, (int)fill, malloc_usable_size( ptr ) );
    8783} // memset
    8884forall( otype T ) T * memset( T * ptr ) {                               // remove when default value available
    89         printf( "memset2\n" );
     85        //printf( "memset2\n" );
    9086    return (T *)memset( ptr, 0, malloc_usable_size( ptr ) );
    9187} // memset
Note: See TracChangeset for help on using the changeset viewer.