Skip to content

Commit

Permalink
* Let Parser use adapters in the case FunctionPointer as well (i…
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Feb 11, 2016
1 parent 1604a0f commit e165acb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Let `Parser` use adapters in the case `FunctionPointer` as well ([issue bytedeco/javacpp-presets#145](https://github.com/bytedeco/javacpp-presets/issues/145))
* Prepend "javacpp." to all properties associated with Maven in `BuildMojo` to avoid name clashes
* Let users define the `GENERIC_EXCEPTION_CLASS` macro (default of `std::exception`) to indicate the base exception thrown by native methods
* Split type names at `::` delimiters before mapping them against templates in `Parser`
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/bytedeco/javacpp/tools/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,14 @@ Declarator declarator(Context context, String defaultName, int infoNumber, boole
tokens.next().expect(',', ';');
}

// if this is a function pointer, get parameters
dcl.parameters = parameters(context, infoNumber, useDefaults);

int infoLength = 1;
boolean valueType = false, needCast = arrayAsPointer && dcl.indices > 1, implicitConst = false;
String prefix = type.constValue && dcl.indirections < 2 && !dcl.reference ? "const " : "";
Info info = infoMap.getFirst(prefix + type.cppName, false);
if (!typedef && (info == null || (info.cppTypes != null && info.cppTypes.length > 0))) {
if ((!typedef || dcl.parameters != null) && (info == null || (info.cppTypes != null && info.cppTypes.length > 0))) {
// substitute template types that have no info with appropriate adapter annotation
Type type2 = type;
if (info != null) {
Expand Down Expand Up @@ -969,7 +972,6 @@ Declarator declarator(Context context, String defaultName, int infoNumber, boole
// deal with function parameters and function pointers
dcl.type = type;
dcl.signature = dcl.javaName;
dcl.parameters = parameters(context, infoNumber, useDefaults);
if (dcl.parameters != null) {
dcl.infoNumber = Math.max(dcl.infoNumber, dcl.parameters.infoNumber);
if (indirections2 == 0 && !typedef) {
Expand Down

0 comments on commit e165acb

Please sign in to comment.