ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        with_gc
      
      
        
          | Last change
 on this file since 2988eeb was             1c31f68, checked in by Thierry Delisle <tdelisle@…>, 9 years ago | 
        
          | 
refactored tests to new python script
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            1.5 KB | 
      
      
| Rev | Line |  | 
|---|
| [86bd7c1f] | 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 | // | 
|---|
| [eab39cd] | 7 | // vector_int.h -- | 
|---|
| [86bd7c1f] | 8 | // | 
|---|
|  | 9 | // Author           : Richard C. Bilson | 
|---|
|  | 10 | // Created On       : Wed May 27 17:56:53 2015 | 
|---|
| [eab39cd] | 11 | // Last Modified By : Rob Schluntz | 
|---|
| [1ad1c99e] | 12 | // Last Modified On : Wed Apr 27 17:26:59 2016 | 
|---|
| [86bd7c1f] | 13 | // Update Count     : 2 | 
|---|
|  | 14 | // | 
|---|
|  | 15 |  | 
|---|
| [51b73452] | 16 | #ifndef VECTOR_INT_H | 
|---|
|  | 17 | #define VECTOR_INT_H | 
|---|
|  | 18 |  | 
|---|
| [134b86a] | 19 | // A flexible array, similar to a C++ vector, that holds integers and can be resized dynamically | 
|---|
| [51b73452] | 20 |  | 
|---|
| [134b86a] | 21 | typedef struct vector_int { | 
|---|
| [86bd7c1f] | 22 | int last;                                                                                       // last used index | 
|---|
|  | 23 | int capacity;                                                                           // last possible index before reallocation | 
|---|
|  | 24 | int *data;                                                                                      // array | 
|---|
| [134b86a] | 25 | } vector_int; | 
|---|
| [51b73452] | 26 |  | 
|---|
| [eab39cd] | 27 | void ?{}( vector_int * );                                                               // allocate vector with default capacity | 
|---|
| [1ad1c99e] | 28 | void ?{}( vector_int *, int reserve );          // allocate vector with specified capacity | 
|---|
|  | 29 | void ?{}( vector_int * vec, vector_int other ); // copy constructor | 
|---|
| [eab39cd] | 30 | void ^?{}( vector_int * );                                                              // deallocate vector's storage | 
|---|
| [51b73452] | 31 |  | 
|---|
| [86bd7c1f] | 32 | void reserve( vector_int *vec, int reserve );                   // reserve more capacity | 
|---|
|  | 33 | void append( vector_int *vec, int element );                    // add element to end of vector, resizing as necessary | 
|---|
| [51b73452] | 34 |  | 
|---|
|  | 35 | // implement bounded_array | 
|---|
|  | 36 |  | 
|---|
| [1ad1c99e] | 37 | lvalue int ?[?]( vector_int * vec, int index );                 // access to arbitrary element (does not resize) | 
|---|
|  | 38 | int last( vector_int * vec );                                                           // return last element | 
|---|
| [51b73452] | 39 |  | 
|---|
| [134b86a] | 40 | #endif // VECTOR_INT_H | 
|---|
| [86bd7c1f] | 41 |  | 
|---|
|  | 42 | // Local Variables: // | 
|---|
|  | 43 | // tab-width: 4 // | 
|---|
|  | 44 | // compile-command: "cfa vector_int.c" // | 
|---|
|  | 45 | // End: // | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.