Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preset for HCC #265

Open
almson opened this issue Aug 11, 2016 · 9 comments
Open

Preset for HCC #265

almson opened this issue Aug 11, 2016 · 9 comments

Comments

@almson
Copy link

almson commented Aug 11, 2016

I'm trying to create a preset for AMD's new GPGPU effort, particularly for the HCC interface. (Honestly, the alphabet soup is such a mess that I'm not going to even begin to explain all of the moving parts. Suffice it to say that I'm targeting hc.hpp).

The first stumbling block I've hit is Unexpected token '::' for the following line:

// namespace alias
// namespace hc::fast_math is an alias of namespace Kalmar::fast_math
namespace fast_math = Kalmar::fast_math;

I'd appreciate any pointers. Does the Parser support this syntax? Is there a workaround?

@saudet saudet added the bug label Aug 11, 2016
@saudet
Copy link
Member

saudet commented Aug 11, 2016

It probably doesn't support that exact syntax, yes.

@almson
Copy link
Author

almson commented Aug 11, 2016

So is there a way I can ignore this line? I'm assuming I can emulate the alias with new Info ("fast_math").cppText ("Kalmar::fast_math"). Sorry, I'm totally new to this and would appreciate pointers.

@almson
Copy link
Author

almson commented Aug 11, 2016

From reading the code, it seems there is no facility to do simple find&replace. cppText seems to only work in specific cases of #define. Am I correct?

If you like, I can post the code I have now. Currently, I have a cppbuild.sh that downloads the HCC header files (no install needed) and a skeleton of a pom and an hc.java.

@saudet
Copy link
Member

saudet commented Aug 11, 2016

cppText expects #define yes, but works with any identifier, it's used by the preprocessor, though you won't be able to do anything that the C++ preprocessor can't do in the first place.

We'll likely have to fix JavaCPP's Parser, but it should be pretty easy. There's someone who a few minutes ago has just fixed a similar bug: #264

If you could help in a similar way, it would be very much appreciated.

@almson
Copy link
Author

almson commented Aug 12, 2016

May I ask why you chose to write your own C++ parser instead of using one of many third-party ones? The Eclipse parser opens hc.hpp without problems (try it: https://github.com/almson/eclipse-cdt-standalone-astparser). There's other options too: https://stackoverflow.com/questions/12865587/parsing-c-source-code-in-java-environment

@saudet
Copy link
Member

saudet commented Aug 12, 2016

Because no existing parser was designed to output a Java interface. Of course that's the long term plan, enhancing some existing parser so it supports what we need. As usual, your help would be very welcome.

saudet added a commit to bytedeco/javacpp that referenced this issue Aug 30, 2016
@saudet
Copy link
Member

saudet commented Aug 30, 2016

Fixed the namespace alias issue. Let me know if you encounter any other issues. Thanks for reporting!

@saudet saudet added enhancement and removed bug labels Dec 9, 2016
@saudet
Copy link
Member

saudet commented Dec 9, 2016

I've fixed the parsing issue you were having. Any other issues with HCC?

@saudet
Copy link
Member

saudet commented Feb 12, 2017

FYI, JetBrains chose to create their own C++ parser, instead of using an existing one as well:
https://blog.jetbrains.com/clion/2015/07/clion-1-1-eap-starts/#comment-13321
If you just keep complaining and don't actually do anything, nothing will get done! Please consider actually doing something. Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants