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 2245, Sun Mar 3 12:51:51 2013 UTC revision 2246, Sun Mar 3 14:51:31 2013 UTC
# Line 1  Line 1 
1  //! add an allocated new strand to the world  //! add an allocated new strand to the world
2   void Diderot_AddNewStrandToWorld(   uint32_t  Diderot_AllocNewStrand(
     @STRANDTY@ * newStrandIn,  
     @STRANDTY@ * newStrandOut,  
3      StrandPoolInfo_t   * poolInfo,      StrandPoolInfo_t   * poolInfo,
4      @STRANDTY@ ** selfIn,      @STRANDTY@ ** selfIn,
5      @STRANDTY@ ** selfOut,      @STRANDTY@ ** selfOut,
6      uint8_t * status)      uint8_t * status)
7  {  {
8      if(poolInfo->handle >= poolInfo->size)      if(poolInfo->handle == poolInfo->size)
9      {      {
10          selfIn = (@STRANDTY@ **)CheckedReAlloc(selfIn,sizeof(@STRANDTY@ *) * (STRAND_POOL_INC_SIZE + poolInfo->size));          selfIn = (@STRANDTY@ **)CheckedReAlloc(selfIn,sizeof(@STRANDTY@ *) * (STRAND_POOL_INC_SIZE + poolInfo->size));
11          selfOut = (@STRANDTY@ **)CheckedReAlloc(selfOut,sizeof(@STRANDTY@ *) * (STRAND_POOL_INC_SIZE + poolInfo->size));          selfOut = (@STRANDTY@ **)CheckedReAlloc(selfOut,sizeof(@STRANDTY@ *) * (STRAND_POOL_INC_SIZE + poolInfo->size));
12          status = (uint8_t *)CheckedReAlloc(status,sizeof(uint8_t) * (STRAND_POOL_INC_SIZE + poolInfo->size));          status = (uint8_t *)CheckedReAlloc(status,sizeof(uint8_t) * (STRAND_POOL_INC_SIZE + poolInfo->size));
13          poolInfo->size += STRAND_POOL_INC_SIZE;          poolInfo->size += STRAND_POOL_INC_SIZE;
14    
15            for(int i = poolInfo->handle; i < poolInfo->size; i++)
16            {
17                selfIn[i] = NEW(@STRANDTY@);
18                selfOut[i] = NEW(@STRANDTY@);
19                status[i] = DIDEROT_ACTIVE;
20            }
21      }      }
22    
23      uint32_t newIdx = (poolInfo->handle)++;      uint32_t newIdx = (poolInfo->handle)++;
     selfIn[newIdx] = newStrandIn;  
     selfOut[newIdx] = newStrandOut;  
     status[newIdx] = DIDEROT_ACTIVE;  
24      (poolInfo->nNewStrand)++;      (poolInfo->nNewStrand)++;
25        return newIdx;
26  }  }

Legend:
Removed from v.2245  
changed lines
  Added in v.2246

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