Changeset 3849857


Ignore:
Timestamp:
Apr 12, 2016, 6:35:18 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
45161b4d, aa19ccf
Parents:
b52d900
Message:

fix stdlib memory allocation, iostream documentation

Location:
src/libcfa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/iostream

    rb52d900 r3849857  
    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/stdlib

    rb52d900 r3849857  
    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 : Tue Apr 12 18:22:54 2016
     13// Update Count     : 77
    1414//
    1515
     
    2222
    2323forall( otype T ) T * malloc( void );
     24extern "C" {
     25void * malloc( size_t );                                                                // use default C for void *
     26} // extern "C"
     27forall( otype T ) T * malloc( size_t size );
    2428forall( otype T ) T * malloc( char fill );
    2529forall( otype T ) T * malloc( T * ptr, size_t size );
  • src/libcfa/stdlib.c

    rb52d900 r3849857  
    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 : Tue Apr 12 18:19:22 2016
     13// Update Count     : 151
    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
    3333forall( otype T ) T * malloc( size_t size ) {
    34         printf( "malloc2\n" );
     34        //printf( "malloc2\n" );
    3535    return (T *)(void *)malloc( size );
    3636} // malloc
    3737forall( otype T ) T * malloc( char fill ) {
    38         printf( "malloc3\n" );
     38        //printf( "malloc3\n" );
    3939        T * ptr = (T *)malloc( sizeof(T) );
    4040    return memset( ptr );
     
    4242
    4343forall( otype T ) T * calloc( size_t size ) {
    44         printf( "calloc\n" );
     44        //printf( "calloc\n" );
    4545    return (T *)calloc( size, sizeof(T) );
    4646} // calloc
    4747
    4848forall( otype T ) T * realloc( T * ptr, size_t size ) {
    49         printf( "realloc1\n" );
     49        //printf( "realloc1\n" );
    5050    return (T *)(void *)realloc( (void *)ptr, size );
    5151} // realloc
    5252forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill ) {
    53         printf( "realloc2\n" );
     53        //printf( "realloc2\n" );
    5454    char * nptr = (T *)(void *)realloc( (void *)ptr, size );
    5555    size_t unused = malloc_usable_size( nptr );
     
    5959
    6060forall( otype T ) T * malloc( T * ptr, size_t size ) {
    61         printf( "malloc4\n" );
     61        //printf( "malloc4\n" );
    6262    return (T *)realloc( ptr, size );
    6363} // malloc
    6464forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill ) {
    65         printf( "malloc5\n" );
     65        //printf( "malloc5\n" );
    6666    return (T *)realloc( ptr, size, fill );
    6767} // malloc
    6868
    6969forall( otype T ) T * aligned_alloc( size_t alignment ) {
    70         printf( "aligned_alloc\n" );
     70        //printf( "aligned_alloc\n" );
    7171    return (T *)memalign( alignment, sizeof(T) );
    7272} // aligned_alloc
    7373
    7474forall( otype T ) T * memalign( size_t alignment ) {
    75         printf( "memalign\n" );
     75        //printf( "memalign\n" );
    7676    return (T *)memalign( alignment, sizeof(T) );
    7777} // memalign
    7878
    7979forall( otype T ) int posix_memalign( T ** ptr, size_t alignment ) {
    80         printf( "posix_memalign\n" );
     80        //printf( "posix_memalign\n" );
    8181    return posix_memalign( (void **)ptr, alignment, sizeof(T) );
    8282} // posix_memalign
    8383
    8484forall( otype T ) T * memset( T * ptr, unsigned char fill ) { // use default value '\0' for fill
    85         printf( "memset1\n" );
     85        //printf( "memset1\n" );
    8686    return (T *)memset( ptr, (int)fill, malloc_usable_size( ptr ) );
    8787} // memset
    8888forall( otype T ) T * memset( T * ptr ) {                               // remove when default value available
    89         printf( "memset2\n" );
     89        //printf( "memset2\n" );
    9090    return (T *)memset( ptr, 0, malloc_usable_size( ptr ) );
    9191} // memset
Note: See TracChangeset for help on using the changeset viewer.