ADT
        arm-eh
        ast-experimental
        enum
        forall-pointer-decay
        jacob/cs343-translation
        new-ast-unique-expr
        pthread-emulation
        qualifiedEnum
      
      
        
          | 
            Last change
 on this file since 0989e79 was             67982887, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago           | 
        
        
          | 
             
specialize thesis directory-names 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            533 bytes
           | 
        
      
      
| Line |   | 
|---|
| 1 | #ifndef SCOPE_GUARD_H
 | 
|---|
| 2 | #define SCOPE_GUARD_H
 | 
|---|
| 3 | 
 | 
|---|
| 4 | struct ScopeGuard {
 | 
|---|
| 5 |   void (*fn)(void *);
 | 
|---|
| 6 |   // Args args;
 | 
|---|
| 7 | };
 | 
|---|
| 8 | 
 | 
|---|
| 9 | // forall(ttype Args, ttype Ret)
 | 
|---|
| 10 | // void ?{}(ScopeGuard(Args, Ret) * this) {
 | 
|---|
| 11 | void ?{}(ScopeGuard * this) {
 | 
|---|
| 12 | 
 | 
|---|
| 13 | }
 | 
|---|
| 14 | 
 | 
|---|
| 15 | // // inline
 | 
|---|
| 16 | // forall(ttype Args, ttype Ret)
 | 
|---|
| 17 | // void ?{}(ScopeGuard(Args, Ret) * this, Ret (*fn)(Args), Args args) {
 | 
|---|
| 18 | //   this->fn = fn;
 | 
|---|
| 19 | //   // this->args = args;
 | 
|---|
| 20 | // }
 | 
|---|
| 21 | 
 | 
|---|
| 22 | // inline
 | 
|---|
| 23 | // forall(ttype Args, ttype Ret)
 | 
|---|
| 24 | // void ^?{}(ScopeGuard(Args, Ret) * this) {
 | 
|---|
| 25 | void ^?{}(ScopeGuard * this) {
 | 
|---|
| 26 |   this->fn(0);
 | 
|---|
| 27 | }
 | 
|---|
| 28 | 
 | 
|---|
| 29 | #endif
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.