Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/vector_int.h

    r86bd7c1f r843054c2  
    1 //
    2 // Cforall Version 1.0.0 Copyright (C) 2015 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 // vector_int.h --
    8 //
    9 // Author           : Richard C. Bilson
    10 // Created On       : Wed May 27 17:56:53 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 27 18:39:05 2015
    13 // Update Count     : 2
    14 //
    15 
    161#ifndef VECTOR_INT_H
    172#define VECTOR_INT_H
     
    205
    216typedef struct vector_int {
    22         int last;                                                                                       // last used index
    23         int capacity;                                                                           // last possible index before reallocation
    24         int *data;                                                                                      // array
     7    int last;                                           // last used index
     8    int capacity;                                       // last possible index before reallocation
     9    int *data;                                          // array
    2510} vector_int;
    2611
    27 vector_int vector_int_allocate();                                               // allocate vector with default capacity
    28 vector_int vector_int_allocate( int reserve );                  // allocate vector with specified capacity
    29 void vector_int_deallocate( vector_int );                               // deallocate vector's storage
     12vector_int vector_int_allocate();                       // allocate vector with default capacity
     13vector_int vector_int_allocate( int reserve );          // allocate vector with specified capacity
     14void vector_int_deallocate( vector_int );               // deallocate vector's storage
    3015
    31 void reserve( vector_int *vec, int reserve );                   // reserve more capacity
    32 void append( vector_int *vec, int element );                    // add element to end of vector, resizing as necessary
     16void reserve( vector_int *vec, int reserve );           // reserve more capacity
     17void append( vector_int *vec, int element );            // add element to end of vector, resizing as necessary
    3318
    3419// implement bounded_array
    3520
    36 lvalue int ?[?]( vector_int vec, int index );                   // access to arbitrary element (does not resize)
    37 int last( vector_int vec );                                                             // return last element
     21lvalue int ?[?]( vector_int vec, int index );           // access to arbitrary element (does not resize)
     22int last( vector_int vec );                             // return last element
    3823
    3924#endif // VECTOR_INT_H
    40 
    41 // Local Variables: //
    42 // tab-width: 4 //
    43 // compile-command: "cfa vector_int.c" //
    44 // End: //
Note: See TracChangeset for help on using the changeset viewer.