Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/lamont/src/compiler/c-target/fragments/seq-new.in
ViewVC logotype

Diff of /branches/lamont/src/compiler/c-target/fragments/seq-new.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2297, Fri Mar 15 22:05:31 2013 UTC revision 2298, Fri Mar 15 22:18:22 2013 UTC
# Line 1  Line 1 
1  //! add an allocated new strand to the world  //! add an allocated new strand to the world
2   uint32_t  Diderot_AllocNewStrand(  uint32_t  @STRAND@_AllocNewStrand (@PREFIX@World_t *wrld)
     StrandPoolInfo_t   * poolInfo,  
     @STRANDTY@ **** selfIn,  
     @STRANDTY@ **** selfOut,  
     uint8_t *** status)  
3  {  {
4      if(poolInfo->handle == poolInfo->size)      StrandPoolInfo_t *poolInfo = &wrld->poolInfo;
5      {      if (poolInfo->handle == poolInfo->size)  {
6          (*(*selfIn)) = (@STRANDTY@ **)CheckedReAlloc((*(*selfIn)),sizeof(@STRANDTY@ *) * (STRAND_POOL_INC_SIZE + poolInfo->size));          uint32_t newSize = poolInfo->size + STRAND_POOL_INC_SIZE;
7          (*(*selfOut)) = (@STRANDTY@ **)CheckedReAlloc((*(*selfOut)),sizeof(@STRANDTY@ *) * (STRAND_POOL_INC_SIZE + poolInfo->size));  #ifdef DIDEROT_DUAL_STATE
8          (*(*status)) = (uint8_t *)CheckedReAlloc( (*(*status)),sizeof(uint8_t) * (STRAND_POOL_INC_SIZE + poolInfo->size));          wrld->inState = (@STRANDTY@ **)CheckedReAlloc(wrld->inState, newSize * sizeof(@STRANDTY@ *));
9          poolInfo->size += STRAND_POOL_INC_SIZE;          wrld->outState = (@STRANDTY@ **)CheckedReAlloc(wrld->outState, newSize * sizeof(@STRANDTY@ *));
10    #else
11            wrld->state = (@STRANDTY@ *)CheckedReAlloc(wrld->state, newSize * sizeof(@STRANDTY@));
12    #endif
13            wrld->status = (uint8_t *)CheckedReAlloc(wrld->status, newSize * sizeof(uint8_t));
14            poolInfo->size = newSize;
15    
16          for(int i = poolInfo->handle; i < poolInfo->size; i++)          for (uint32_t i = poolInfo->handle; i < poolInfo->size; i++) {
17          {  #ifdef DIDEROT_DUAL_STATE
18              (*(*selfIn))[i] = NEW(@STRANDTY@);              wrld->inState[i] = NEW(@STRANDTY@);
19             (*(*selfOut))[i] = NEW(@STRANDTY@);              wrld->outState[i] = NEW(@STRANDTY@);
20              (*(*status))[i] = DIDEROT_ACTIVE;  #endif
21                wrld->status[i] = DIDEROT_ACTIVE;
22          }          }
23      }      }
24    
25      uint32_t newIdx = (poolInfo->handle)++;      uint32_t newIdx = poolInfo->handle++;
26      (poolInfo->nNewStrand)++;      poolInfo->nNewStrand++;
27      return newIdx;      return newIdx;
28  }  }

Legend:
Removed from v.2297  
changed lines
  Added in v.2298

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0