/[escript]/trunk/paso/src/Pattern.c
ViewVC logotype

Diff of /trunk/paso/src/Pattern.c

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

revision 1388 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 1736 by gross, Fri Aug 29 02:23:16 2008 UTC
# Line 30  Line 30 
30    
31  /* allocates a Pattern  */  /* allocates a Pattern  */
32    
33  Paso_Pattern* Paso_Pattern_alloc(int type, dim_t input_block_size, dim_t output_block_size, dim_t numOutput, index_t* ptr, index_t* index) {  Paso_Pattern* Paso_Pattern_alloc(int type, dim_t input_block_size, dim_t output_block_size, dim_t numOutput, dim_t numInput, index_t* ptr, index_t* index) {
34    Paso_Pattern*out=NULL;    Paso_Pattern*out=NULL;
35    index_t index_offset=(type & PATTERN_FORMAT_OFFSET1 ? 1:0);    index_t index_offset=(type & PATTERN_FORMAT_OFFSET1 ? 1:0);
36    index_t loc_min_index,loc_max_index,min_index=index_offset,max_index=index_offset-1;    index_t loc_min_index,loc_max_index,min_index=index_offset,max_index=index_offset-1;
# Line 79  Paso_Pattern* Paso_Pattern_alloc(int typ Line 79  Paso_Pattern* Paso_Pattern_alloc(int typ
79             max_index=MAX(loc_max_index,max_index);             max_index=MAX(loc_max_index,max_index);
80          }          }
81      }      }
82      if (min_index<index_offset) {      if ( (min_index<index_offset) || (max_index>=numInput+index_offset) ) {
83        Paso_setError(TYPE_ERROR,"Paso_Pattern_alloc: lower Pattern index out of range.");        Paso_setError(TYPE_ERROR,"Paso_Pattern_alloc: Pattern index out of range.");
84        return NULL;        return NULL;
85      }      }
86    }    }
# Line 89  Paso_Pattern* Paso_Pattern_alloc(int typ Line 89  Paso_Pattern* Paso_Pattern_alloc(int typ
89        out->type=type;        out->type=type;
90        out->reference_counter=1;        out->reference_counter=1;
91        out->numOutput=numOutput;        out->numOutput=numOutput;
92          out->numInput=numInput;
93        out->ptr=ptr;        out->ptr=ptr;
94        out->index=index;        out->index=index;
95        out->input_block_size=input_block_size;        out->input_block_size=input_block_size;
# Line 96  Paso_Pattern* Paso_Pattern_alloc(int typ Line 97  Paso_Pattern* Paso_Pattern_alloc(int typ
97        out->block_size=out->input_block_size * out->output_block_size;        out->block_size=out->input_block_size * out->output_block_size;
98        if (out->ptr == NULL) {        if (out->ptr == NULL) {
99            out->len=0;            out->len=0;
           out->numInput=0;  
100        } else {        } else {
101            out->len=out->ptr[out->numOutput] - index_offset;            out->len=out->ptr[out->numOutput] - index_offset;
           out->numInput=max_index+1-index_offset;  
102        }        }
103    }    }
104    #ifdef Paso_TRACE    #ifdef Paso_TRACE

Legend:
Removed from v.1388  
changed lines
  Added in v.1736

  ViewVC Help
Powered by ViewVC 1.1.26