Fix a small parsing problem with arguments of type rs_matrix2x2, 3x3, 4x4.

Also fix some style issues and added a missing comment.

Change-Id: Ieaca181453f38f948bc2a5e3d183b264d7215413
diff --git a/api/GenerateHeaderFiles.cpp b/api/GenerateHeaderFiles.cpp
index db94b40..97ccab6 100644
--- a/api/GenerateHeaderFiles.cpp
+++ b/api/GenerateHeaderFiles.cpp
@@ -370,7 +370,7 @@
     return true;
 }
 
-bool GenerateHeaderFiles(const string& directory) {
+bool generateHeaderFiles(const string& directory) {
     bool success = true;
     for (auto specFile : systemSpecification.getSpecFiles()) {
         if (!writeHeaderFile(directory, *specFile)) {
diff --git a/api/GenerateTestFiles.cpp b/api/GenerateTestFiles.cpp
index 529bd2a..11bd913 100644
--- a/api/GenerateTestFiles.cpp
+++ b/api/GenerateTestFiles.cpp
@@ -1028,7 +1028,7 @@
     return true;
 }
 
-bool GenerateTestFiles(const string& directory, int versionOfTestFiles) {
+bool generateTestFiles(const string& directory, int versionOfTestFiles) {
     bool success = true;
     for (auto f : systemSpecification.getFunctions()) {
         if (!writeTestFilesForFunction(*f.second, directory, versionOfTestFiles)) {
diff --git a/api/Generator.cpp b/api/Generator.cpp
index 376364c..dbd179b 100644
--- a/api/Generator.cpp
+++ b/api/Generator.cpp
@@ -62,6 +62,7 @@
  * [size: {32 or 64.  Used if this is available only for 32 or 64 bit code.}]
  * value: {The value of the constant.}
  * [hidden:]   ...If present, don't document the constant.  Omit the following two fields.
+ * [deprecated: [{Deprecation message.}]   ... This is deprecated.  Compiler will issue a wrning.
  * summary: {A one line string describing this section.}
  * description:
  *     {Multiline description.  Can include HTML.  References to constants, types,
@@ -75,6 +76,7 @@
  * [size: {32 or 64.  Used if this is available only for 32 or 64 bit code.}]
  * simple: {The C declaration that this type is the typedef equivalent.}
  * [hidden:]   ...If present, don't document the type.  Omit the following two fields.
+ * [deprecated: [{Deprecation message.}]   ... This is deprecated.  Compiler will issue a wrning.
  * summary: {A one line string describing this section.}
  * description:
  *     {Multiline description.  Can include HTML.  References to constants, types,
@@ -122,6 +124,7 @@
  * [arg: {Type}[, {Name}][, {ParameterEntry.testOption}][, "{One line documentation of the field}"]]
  * [arg:   ... Same for all the other arguments of the function.]
  * [hidden:]   ... If present, don't include in the HTML documentation.
+ * [deprecated: [{Deprecation message.}]   ... This is deprecated.  Compiler will issue a wrning.
  * summary: {A one line string describing this section.}
  * description:
  *     {Multiline description.  Can include HTML.  References to constants, types,
diff --git a/api/Generator.h b/api/Generator.h
index 95534b3..090a69f 100644
--- a/api/Generator.h
+++ b/api/Generator.h
@@ -18,10 +18,10 @@
 #define ANDROID_RS_API_GENERATOR_GENERATOR_H
 
 // Generates the RenderScript header files.  The implementation is in GenerateHeaderFiles.cpp.
-bool GenerateHeaderFiles(const std::string& directory);
+bool generateHeaderFiles(const std::string& directory);
 
 // Generates the Java and RenderScript test files.  The implementation is in GenerateTestFiles.cpp.
-bool GenerateTestFiles(const std::string& directory, int versionOfTestFiles);
+bool generateTestFiles(const std::string& directory, int versionOfTestFiles);
 
 // Generates all HTML documentation files.  The implementation is in GenerateHtmlDocumentation.cpp.
 bool generateHtmlDocumentation(const std::string& director);
diff --git a/api/Specification.cpp b/api/Specification.cpp
index 6fd115c..0dbaa73 100644
--- a/api/Specification.cpp
+++ b/api/Specification.cpp
@@ -108,16 +108,25 @@
     // Determine if this is an output.
     isOutParameter = isReturn || charRemoved('*', &rsType);
 
-    // Extract the vector size out of the type.
-    int last = rsType.size() - 1;
-    char lastChar = rsType[last];
+    rsBaseType = rsType;
+    mVectorSize = "1";
+    /* If it's a vector type, we need to split the base type from the size.
+     * We know that's it's a vector type if the last character is a digit and
+     * the rest is an actual base type.   We used to only verify the first part,
+     * which created a problem with rs_matrix2x2.
+     */
+    const int last = rsType.size() - 1;
+    const char lastChar = rsType[last];
     if (lastChar >= '0' && lastChar <= '9') {
-        rsBaseType = rsType.substr(0, last);
-        mVectorSize = lastChar;
-    } else {
-        rsBaseType = rsType;
-        mVectorSize = "1";
+        const string trimmed = rsType.substr(0, last);
+        int i = findCType(trimmed);
+        if (i >= 0) {
+            rsBaseType = trimmed;
+            mVectorSize = lastChar;
+        }
     }
+    typeIndex = findCType(rsBaseType);
+
     if (mVectorSize == "3") {
         vectorWidth = "4";
     } else {
@@ -179,7 +188,6 @@
         }
     }
 
-    typeIndex = findCType(rsBaseType);
     isFloatType = false;
     if (typeIndex >= 0) {
         javaBaseType = TYPES[typeIndex].javaType;
@@ -762,8 +770,8 @@
 }
 
 bool SystemSpecification::generateFiles(int versionOfTestFiles) const {
-    bool success = GenerateHeaderFiles("scriptc") && generateHtmlDocumentation("html") &&
-                   GenerateTestFiles("test", versionOfTestFiles);
+    bool success = generateHeaderFiles("scriptc") && generateHtmlDocumentation("html") &&
+                   generateTestFiles("test", versionOfTestFiles);
     if (success) {
         cout << "Successfully processed " << mTypes.size() << " types, " << mConstants.size()
              << " constants, and " << mFunctions.size() << " functions.\n";
diff --git a/api/Specification.h b/api/Specification.h
index 3fa1aa3..abd9d9c 100644
--- a/api/Specification.h
+++ b/api/Specification.h
@@ -322,6 +322,7 @@
      *           This is useful for APIs like dot() or length().
      * "noverify": Generate test code that calls the API but don't verify the returned value.
      *             This can discover unresolved references.
+     * "": Don't test.  This is the default.
      */
     std::string mTest;
     std::string mAttribute;       // Function attributes.
@@ -427,7 +428,7 @@
     std::string getTest() const { return mTest; }
     std::string getPrecisionLimit() const { return mPrecisionLimit; }
 
-    const std::vector<std::string> getInline() const { return mInline; }
+    const std::vector<std::string>& getInline() const { return mInline; }
     const ParameterDefinition* getReturn() const { return mReturn; }
     int getInputCount() const { return mInputCount; }
     int getOutputCount() const { return mOutputCount; }