graveyard/tools/org/apache/axis/tools/trace/TraceInstrumentor.java
/**
	 * Parses the given file and adds trace to it, placing the newly traced code 
	 * into the outputfile
	 * 
	 * @param inputFile the input file reader
	 * @param outputFile the output file writer
	 */
Parses the given file and adds trace to it, placing the newly traced code
into the outputfile

@param inputFile the input file reader
@param outputFile the output file writer
Parses the given file and adds trace to it placing the newly traced code into the outputfile @param inputFile the input file reader @param outputFile the output file writer
private void parseFile(InputCppSourceCode inputFile, Tracer outputFile)
		throws Exception {
		Iterator it = inputFile.getPartIterator();
		while (it.hasNext()) {
			FilePart fp = (FilePart) (it.next());
			if (fp.getType() == FilePart.METHOD) {
				MethodPart mp = (MethodPart) fp;
				outputFile.writeTrace(mp.getOriginalSignature() + "{");
				outputFile.traceEntry(mp.getSignature());
				BodyPart[] bps = mp.getBodyParts();
				int returnCount = 0,
					catchCount = 0,
					returnIndex = 0,
					catchIndex = 0;
				for (int i = 0; i < bps.length - 1; i++)
					if (bps[i].isReturn())
						returnCount++;
				for (int i = 0; i < bps.length - 1; i++)
					if (bps[i].isCatch())
						catchCount++;
				for (int i = 0; i < bps.length; i++) {
					outputFile.writeTrace(bps[i].getCodeFragment());
					if (bps[i].isReturn()) {
						if (returnCount > 1)
							returnIndex++;
						outputFile.traceExit(
							bps[i].getReturnValue(),
							returnIndex);
					} else if (bps[i].isCatch()) {
						if (catchCount > 1)
							catchIndex++;
						outputFile.traceCatch(
							bps[i].getCaughtValue(),
							catchIndex);
					} else if (i < bps.length - 1) {
						if (returnCount > 1)
							returnIndex++;
						outputFile.traceExit(returnIndex);
					}
				}
			} else {
				outputFile.writeTrace(fp.toString());
			}
		}
	}
private void parseFile ( InputCppSourceCode inputFile , Tracer outputFile ) throws Exception { Iterator it = inputFile . getPartIterator ( ) ; while ( it . hasNext ( ) ) { FilePart fp = ( FilePart ) ( it . next ( ) ) ; if ( fp . getType ( ) == FilePart . METHOD ) { MethodPart mp = ( MethodPart ) fp ; outputFile . writeTrace ( mp . getOriginalSignature ( ) + "{" ) ; outputFile . traceEntry ( mp . getSignature ( ) ) ; BodyPart [ ] bps = mp . getBodyParts ( ) ; int returnCount = 0 , catchCount = 0 , returnIndex = 0 , catchIndex = 0 ; for ( int i = 0 ; i < bps . length - 1 ; i ++ ) if ( bps [ i ] . isReturn ( ) ) returnCount ++ ; for ( int i = 0 ; i < bps . length - 1 ; i ++ ) if ( bps [ i ] . isCatch ( ) ) catchCount ++ ; for ( int i = 0 ; i < bps . length ; i ++ ) { outputFile . writeTrace ( bps [ i ] . getCodeFragment ( ) ) ; if ( bps [ i ] . isReturn ( ) ) { if ( returnCount > 1 ) returnIndex ++ ; outputFile . traceExit ( bps [ i ] . getReturnValue ( ) , returnIndex ) ; } else if ( bps [ i ] . isCatch ( ) ) { if ( catchCount > 1 ) catchIndex ++ ; outputFile . traceCatch ( bps [ i ] . getCaughtValue ( ) , catchIndex ) ; } else if ( i < bps . length - 1 ) { if ( returnCount > 1 ) returnIndex ++ ; outputFile . traceExit ( returnIndex ) ; } } } else { outputFile . writeTrace ( fp . toString ( ) ) ; } } }
Parses the given file and adds trace to it, placing the newly traced code
 into the outputfile
Parses the given file and adds trace to it placing the newly traced code into the outputfile