Package org.apache.axis.tools.common

Examples of org.apache.axis.tools.common.FilePart


    int prevPart = FilePart.COMMENT; // Suppresse newline before copyright
    String text;
    Iterator it = inputFile.getPartIterator();
    while (it.hasNext()) {
      FilePart fp = (FilePart) (it.next());
      if (!foundCopyright
        && (FilePart.DIRECTIVE == fp.getType()
          || FilePart.ENUM == fp.getType()
          || FilePart.PROTOTYPE == fp.getType())) {
        outputFile.write("#ifndef " + define);
        outputFile.newLine();
        outputFile.write("#define " + define);
        outputFile.newLine();
        foundCopyright = true;
      }

      switch (fp.getType()) {
        case FilePart.COMMENT :
          if (FilePart.COMMENT != prevPart)
            outputFile.newLine();
          prevPart = fp.getType();
          text = fp.toString().trim();
          StringTokenizer tkzr = new StringTokenizer(text, "\n\r");
          while (tkzr.hasMoreTokens()) {
            String line = tkzr.nextToken();
            if (-1 == line.indexOf("@author")) {
              outputFile.write(line);
              outputFile.newLine();
            }
          }
          break;

        case FilePart.DIRECTIVE :
          if (FilePart.DIRECTIVE != prevPart)
            outputFile.newLine();
          prevPart = fp.getType();
          generateDirective(fp, outputFile, inputFile.getName());
          break;

        case FilePart.TYPEDEF :
          prevPart = fp.getType();
          generateTypedef(fp, outputFile);
          break;

        case FilePart.METHOD :
        case FilePart.PROTOTYPE :
          if (FilePart.COMMENT != prevPart
            && FilePart.METHOD != prevPart
            && FilePart.PROTOTYPE != prevPart)
            outputFile.newLine();
          prevPart = fp.getType();
          generateFunctionPrototype(fp, outputFile);
          break;

        case FilePart.ENUM :
          Utils.rude(
            "Enums should be wrappered with a typedef so "
              + "they appear the same in C and C++",
            inputFile.getName(),
            0,
            fp.toString());
          break;
          // do nothing for other file parts
      }
    }
View Full Code Here


   */
  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());
      }
    }
  }
View Full Code Here

    int prevPart = FilePart.COMMENT; // Suppresse newline before copyright
    String text;
    Iterator it = inputFile.getPartIterator();
    while (it.hasNext())
        {
      FilePart fp = (FilePart) (it.next());
      if (!foundCopyright
        && (FilePart.DIRECTIVE == fp.getType()
          || FilePart.ENUM == fp.getType()
          || FilePart.PROTOTYPE == fp.getType()))
            {
        outputFile.write("#ifndef " + define);
        outputFile.newLine();
        outputFile.write("#define " + define);
        outputFile.newLine();
                outputFile.newLine();
                outputFile.write(syncComment)
                outputFile.newLine();
                outputFile.write(cplusplusStart)
                outputFile.newLine();               
        foundCopyright = true;
      }

      switch (fp.getType()) {
        case FilePart.COMMENT :
          if (FilePart.COMMENT != prevPart)
            outputFile.newLine();
          prevPart = fp.getType();
          text = fp.toString().trim();
          StringTokenizer tkzr = new StringTokenizer(text, "\n\r");
          while (tkzr.hasMoreTokens()) {
            String line = tkzr.nextToken();
            if (-1 == line.indexOf("@author")) {
              outputFile.write(line);
              outputFile.newLine();
            }
          }
          break;

        case FilePart.DIRECTIVE :
          if (FilePart.DIRECTIVE != prevPart)
            outputFile.newLine();
          prevPart = fp.getType();
          generateDirective(fp, outputFile, inputFile.getName());
          break;

        case FilePart.TYPEDEF :
          prevPart = fp.getType();
          generateTypedef(fp, outputFile);
          break;

        case FilePart.METHOD :
        case FilePart.PROTOTYPE :
          if (FilePart.COMMENT != prevPart
            && FilePart.METHOD != prevPart
            && FilePart.PROTOTYPE != prevPart)
            outputFile.newLine();
          prevPart = fp.getType();
          generateFunctionPrototype(fp, outputFile);
          break;

        case FilePart.ENUM :
          Utils.rude(
            "Enums should be wrappered with a typedef so "
              + "they appear the same in C and C++",
            inputFile.getName(),
            0,
            fp.toString());
          break;
          // do nothing for other file parts
      }
    }
View Full Code Here

   */
  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());
      }
    }
  }
View Full Code Here

    int prevPart = FilePart.COMMENT; // Suppresse newline before copyright
    String text;
    Iterator it = inputFile.getPartIterator();
    while (it.hasNext()) {
      FilePart fp = (FilePart) (it.next());
      if (!foundCopyright
        && (FilePart.DIRECTIVE == fp.getType()
          || FilePart.ENUM == fp.getType()
          || FilePart.PROTOTYPE == fp.getType())) {
        outputFile.write("#ifndef " + define);
        outputFile.newLine();
        outputFile.write("#define " + define);
        outputFile.newLine();
        foundCopyright = true;
      }

      switch (fp.getType()) {
        case FilePart.COMMENT :
          if (FilePart.COMMENT != prevPart)
            outputFile.newLine();
          prevPart = fp.getType();
          text = fp.toString().trim();
          StringTokenizer tkzr = new StringTokenizer(text, "\n\r");
          while (tkzr.hasMoreTokens()) {
            String line = tkzr.nextToken();
            if (-1 == line.indexOf("@author")) {
              outputFile.write(line);
              outputFile.newLine();
            }
          }
          break;

        case FilePart.DIRECTIVE :
          if (FilePart.DIRECTIVE != prevPart)
            outputFile.newLine();
          prevPart = fp.getType();
          generateDirective(fp, outputFile, inputFile.getName());
          break;

        case FilePart.TYPEDEF :
          prevPart = fp.getType();
          generateTypedef(fp, outputFile);
          break;

        case FilePart.METHOD :
        case FilePart.PROTOTYPE :
          if (FilePart.COMMENT != prevPart
            && FilePart.METHOD != prevPart
            && FilePart.PROTOTYPE != prevPart)
            outputFile.newLine();
          prevPart = fp.getType();
          generateFunctionPrototype(fp, outputFile);
          break;

        case FilePart.ENUM :
          Utils.rude(
            "Enums should be wrappered with a typedef so "
              + "they appear the same in C and C++",
            inputFile.getName(),
            0,
            fp.toString());
          break;
          // do nothing for other file parts
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.axis.tools.common.FilePart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.