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

Port Super author/license to C++ #110

Closed
wants to merge 3 commits into from

Conversation

@swesterfeld
Copy link
Collaborator

swesterfeld commented Jul 28, 2019

This is the first string property port that uses the APPLY_IDL_PROPERTY macro. Since there is no version of constrain_idl_property for strings, your code didn't compile when instantiated with strings. So I used C++17 if constexpr for checking for the type which compiles now. This means strings are not constrained (and all other types). If that wasn't your intention when writing the code, probably a String specialization of constrain_idl_property would be better.

I preserved the quark setting/getting (no idea why it is done this way in the first place). However I wonder if SuperImpl shouldn't simply have two string members, one for author and one for license.

For these types, no constraints checking is performed.

Signed-off-by: Stefan Westerfeld <stefan@space.twc.de>
@swesterfeld

This comment has been minimized.

Copy link
Collaborator Author

swesterfeld commented Jul 28, 2019

I also don't know how to port sfi_pspec_time typed properties. And copyright looks like it can be removed (?), has a // COMPAT-FIXME: remove around 0.7.0

@swesterfeld swesterfeld force-pushed the swesterfeld:pport-super branch from d5925a8 to e4883a5 Aug 3, 2019
swesterfeld added 2 commits Jul 28, 2019
Signed-off-by: Stefan Westerfeld <stefan@space.twc.de>
Signed-off-by: Stefan Westerfeld <stefan@space.twc.de>
@swesterfeld swesterfeld force-pushed the swesterfeld:pport-super branch from 9b1d14e to b81daf4 Aug 3, 2019
@swesterfeld

This comment has been minimized.

Copy link
Collaborator Author

swesterfeld commented Aug 3, 2019

As discussed,

  • I removed quark based properties and replaced them with String members
  • I removed the copyright property (which only very old files would have)
  • I don't port the timestamps for now
@swesterfeld

This comment has been minimized.

Copy link
Collaborator Author

swesterfeld commented Aug 5, 2019

This triggers a problem in your scanner_parse_paren_rest modifications to bsestorage.cc (also appears to break travis CI):

stefan@quadcorn:~/src/ghbeast (pport-super *% u=)$ make -j1 check
[...]
  CHECK    out/tests/bsefiles.lst-b
bsetool: bse/bsestorage.cc:726: scanner_parse_paren_rest: assertion failed: text1 > text0 && text1[-1] == ')'
./media/Demos/x2-midi-test.bse:106: error: failure around character ')' - aborting...
check-load: ./media/Demos/x2-midi-test.bse: loading failed: Bse.Error.PARSE_ERROR
tests/Makefile.mk:84: recipe for target 'out/tests/bsefiles.lst-b-test' failed
make: *** [out/tests/bsefiles.lst-b-test] Error 1

From what I could debug, this is a problem of your code accessing the internal GScanner buffer (scanner->text). It looks like the buffer was refilled during the loop that should read the property, so that text1 is smaller than text0. One way to fix it could be to load the entire file into memory before parsing.

@tim-janik

This comment has been minimized.

Copy link
Owner

tim-janik commented Aug 9, 2019

From what I could debug, this is a problem of your code accessing the internal GScanner buffer (scanner->text). It looks like the buffer was refilled during the loop that should read the property, so that text1 is smaller than text0. One way to fix it could be to load the entire file into memory before parsing.

Thanks a lot for an accurate analysis and suggesting a proper fix, great input!

@tim-janik tim-janik closed this in 44251ab Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.