Introduce VMOPTIONLEN that can offset the extra '-' in the calculations. You can view, comment on, or merge this pull request online at:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/231
-- Commit Summary --
* macos: Fix --trace for the PharoVM
-- File Changes --
M platforms/iOS/vm/OSX/sqSqueakOSXApplication.m (16)
-- Patch Links --
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/231.patch https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/231.diff
krono commented on this pull request.
@@ -166,7 +168,7 @@ - (int) parseArgument: (NSString *) argData peek: (char *) peek
/* Options with no arguments */
NS_DURING; - if ([argData compare: VMOPTIONOBJ("psn_") options: NSLiteralSearch range: NSMakeRange(0,5)] == NSOrderedSame) { + if ([argData compare: VMOPTIONOBJ("psn_") options: NSLiteralSearch range: NSMakeRange(0,VMOPTIONLEN(5))] == NSOrderedSame) {
Side comment: using `VMOPTIONOBJ` makes no sense for "psn_". It will always have exactly one dash, so using VMOPTIONOBJ (and the otherwise useful VMOPTIONLEN) makes no sense
zecke commented on this pull request.
@@ -166,7 +168,7 @@ - (int) parseArgument: (NSString *) argData peek: (char *) peek
/* Options with no arguments */
NS_DURING; - if ([argData compare: VMOPTIONOBJ("psn_") options: NSLiteralSearch range: NSMakeRange(0,5)] == NSOrderedSame) { + if ([argData compare: VMOPTIONOBJ("psn_") options: NSLiteralSearch range: NSMakeRange(0,VMOPTIONLEN(5))] == NSOrderedSame) {
Good point. OSX doesn't care about the number of dashes we have. I don't like the code. We should strip the dashes before parsing the arguments but that would have been a bigger change and outside the timebox I had. :(
krono commented on this pull request.
@@ -166,7 +168,7 @@ - (int) parseArgument: (NSString *) argData peek: (char *) peek
/* Options with no arguments */
NS_DURING; - if ([argData compare: VMOPTIONOBJ("psn_") options: NSLiteralSearch range: NSMakeRange(0,5)] == NSOrderedSame) { + if ([argData compare: VMOPTIONOBJ("psn_") options: NSLiteralSearch range: NSMakeRange(0,VMOPTIONLEN(5))] == NSOrderedSame) {
No problem, just a side comment to not forget
Agree, we can do better, but this is good enough, we'll see better later. See also https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/136 https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/181
Merged #231.
vm-dev@lists.squeakfoundation.org