for (int i=0; i<(x-1); i++) { body.addStatement(makeArrayAddAndPushStatement(partialField, outputBufferField, i));
for (int currentOutput=0; currentOutput<(x-1); currentOutput++) {  for (int currentFIR=0; currentFIR<numFIRs; currentFIR++) { body.addStatement(makeArrayAddAndPushStatement(partialFields[currentFIR], outputBufferFields[currentFIR], currentOutput)); }
    public JMethodDeclaration makeNewWork(int functionType, /* either INITWORK or WORK */					  JVariableDefinition weightField,					  JVariableDefinition partialField,					  JVariableDefinition inputBufferField,					  JVariableDefinition outputBufferField,					  int filterSize, int x, int N) {	// parameter check	if ((functionType != INITWORK) && (functionType != WORK)) {	    throw new IllegalArgumentException("function type must be either WORK or INITWORK");	}	/* the body of the new work function */	JBlock body = new JBlock();		/* now, copy the data from the input tape into the input buffer, element by element */	for (int i=0; i<(N+x-1); i++) {	    SIRPeekExpression currentPeekExpr   = new SIRPeekExpression(new JIntLiteral(i), CStdType.Float);	    /* note that currentAssignExpr is buff[i] = peek(i) */	    body.addStatement(makeArrayAssignment(inputBufferField, i, currentPeekExpr));	}		/* add statements to set the rest of the input buffer (eg pad with zeros). */	for (int i=(N+x-1); i<(N+2*(x-1)); i++) {	    body.addStatement(makeArrayAssignment(inputBufferField, i, 0.0f));	}	// now, convert the input buffer to frequency	body.addStatement(makeTimeToFrequencyConversion(inputBufferField, filterSize));			// make a callout to the complex multiplication routine.	// the prototype is:	// static void do_halfcomplex_multiply(float *Y, float *X, float *H, int size);	JExpression[] externalArgs = new JExpression[4];	externalArgs[0] = new JFieldAccessExpression(null, new JThisExpression(null),						     outputBufferField.getIdent());	externalArgs[1] = new JFieldAccessExpression(null, new JThisExpression(null),						     inputBufferField.getIdent());	externalArgs[2] = new JFieldAccessExpression(null, new JThisExpression(null),						     weightField.getIdent());	externalArgs[3] = new JIntLiteral(filterSize);	JMethodCallExpression externalCall = new JMethodCallExpression(null,           /* token reference */								       null,               /* prefix */								       MULTIPLY_EXTERNAL, /* ident */								       externalArgs);      /* args */	JavaStyleComment[] externalComment = makeComment("callout to " + MULTIPLY_EXTERNAL +							 " to calculate Y[k] = X[k].*H[k]"); 	body.addStatement(new JExpressionStatement(null,externalCall,externalComment)); /* comments */		// make a callout to the inverse transform routine to get the real output	externalArgs = new JExpression[2];	externalArgs[0] = new JFieldAccessExpression(null, new JThisExpression(null),						     outputBufferField.getIdent());	externalArgs[1] = new JIntLiteral(filterSize);	externalCall = new JMethodCallExpression(null,           /* token reference */						 null,               /* prefix */						 FROM_FREQ_EXTERNAL, /* ident */						 externalArgs);      /* args */	externalComment = makeComment("callout to " + FROM_FREQ_EXTERNAL +				      " to calculate y[n] = IFFT(Y[k])"); 	body.addStatement(new JExpressionStatement(null,externalCall,externalComment)); /* comments */				/* if we are in the normal work function, push out the first x-1	   values from the local buffer added to the partial results */	if (functionType == WORK) {	    for (int i=0; i<(x-1); i++) {		body.addStatement(makeArrayAddAndPushStatement(partialField, outputBufferField, i));	    }	}	    	//now, put in code that will push the appropriate N values of inputBuffer[x-1 to N+(x-1)]	//back on the tape	for (int i=(x-1); i<(N+x-1); i++) {	    body.addStatement(makeArrayPushStatement(outputBufferField, i));	}		/* now, copy the last x-1 values in the input buffer into the partial results buffer. */	for (int i=0; i<x-1; i++) {	    body.addStatement(makePartialCopyExpression(partialField, i,							outputBufferField, (N+x-1)+i));	}			     	/* stick in the appropriate number (N+x-1) of pop calls */	for (int i=0; i<(N+x-1); i++) {	    body.addStatement(makePopStatement());	}		/* figure out what the name of the function should be (work, or initWork) **/	String ident = (functionType == WORK) ? "work" : "initWork";		/* wrap up all the mess that we just made into a new JMethodDeclaration and return it to the caller */	return new JMethodDeclaration(null,                  /* token reference */				      ACC_PUBLIC,            /* modifiers */				      CStdType.Void,         /* return type */				      ident,                 /* identifier */				      JFormalParameter.EMPTY,/* paramters */				      CClassType.EMPTY,      /* exceptions */				      body,                  /* body */				      null,                  /* java doc */				      null);                 /* java style comment */    }