{"action":"created","issue":{"url":"https://api.github.com/repos/parallaxinc/Parallax-IDE/issues/166","labels_url":"https://api.github.com/repos/parallaxinc/Parallax-IDE/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/parallaxinc/Parallax-IDE/issues/166/comments","events_url":"https://api.github.com/repos/parallaxinc/Parallax-IDE/issues/166/events","html_url":"https://github.com/parallaxinc/Parallax-IDE/issues/166","id":89618833,"number":166,"title":"Automatic Download - No module types that match but alternative module available","user":{"login":"phated","id":992373,"avatar_url":"https://avatars.githubusercontent.com/u/992373?v=3","gravatar_id":"","url":"https://api.github.com/users/phated","html_url":"https://github.com/phated","followers_url":"https://api.github.com/users/phated/followers","following_url":"https://api.github.com/users/phated/following{/other_user}","gists_url":"https://api.github.com/users/phated/gists{/gist_id}","starred_url":"https://api.github.com/users/phated/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phated/subscriptions","organizations_url":"https://api.github.com/users/phated/orgs","repos_url":"https://api.github.com/users/phated/repos","events_url":"https://api.github.com/users/phated/events{/privacy}","received_events_url":"https://api.github.com/users/phated/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/parallaxinc/Parallax-IDE/labels/Priority%201","name":"Priority 1","color":"f7c6c7"}],"state":"open","locked":false,"assignee":{"login":"drquinn","id":2586086,"avatar_url":"https://avatars.githubusercontent.com/u/2586086?v=3","gravatar_id":"","url":"https://api.github.com/users/drquinn","html_url":"https://github.com/drquinn","followers_url":"https://api.github.com/users/drquinn/followers","following_url":"https://api.github.com/users/drquinn/following{/other_user}","gists_url":"https://api.github.com/users/drquinn/gists{/gist_id}","starred_url":"https://api.github.com/users/drquinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drquinn/subscriptions","organizations_url":"https://api.github.com/users/drquinn/orgs","repos_url":"https://api.github.com/users/drquinn/repos","events_url":"https://api.github.com/users/drquinn/events{/privacy}","received_events_url":"https://api.github.com/users/drquinn/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/parallaxinc/Parallax-IDE/milestones/7","html_url":"https://github.com/parallaxinc/Parallax-IDE/milestones/Sprint%207","labels_url":"https://api.github.com/repos/parallaxinc/Parallax-IDE/milestones/7/labels","id":1173135,"number":7,"title":"Sprint 7","description":"","creator":{"login":"phated","id":992373,"avatar_url":"https://avatars.githubusercontent.com/u/992373?v=3","gravatar_id":"","url":"https://api.github.com/users/phated","html_url":"https://github.com/phated","followers_url":"https://api.github.com/users/phated/followers","following_url":"https://api.github.com/users/phated/following{/other_user}","gists_url":"https://api.github.com/users/phated/gists{/gist_id}","starred_url":"https://api.github.com/users/phated/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phated/subscriptions","organizations_url":"https://api.github.com/users/phated/orgs","repos_url":"https://api.github.com/users/phated/repos","events_url":"https://api.github.com/users/phated/events{/privacy}","received_events_url":"https://api.github.com/users/phated/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":0,"state":"open","created_at":"2015-06-19T22:27:29Z","updated_at":"2015-07-14T21:46:37Z","due_on":"2015-07-17T07:00:00Z","closed_at":null},"comments":3,"created_at":"2015-06-19T17:31:51Z","updated_at":"2015-07-15T06:41:15Z","closed_at":null,"body":"__Scenario__\r\nNo modules of the type specified in the source code are found to be connected, however, at least one module of another type were found to be connected\r\n\r\n__Behavior__\r\n* Prompt user with \"BASIC Stamp X not found. Select alternate module instead?\" ;where 'X' is the type of BASIC Stamp that the code was written for.\r\n* If the user selects the Cancel button; close the display and cancel operation\r\n* If the user selects a module,\r\n    * automatically modify the source code to change the $STAMP directive to reflect the new desired module type (you can use the tokenizer's returned information to find the specific source and location to change)\r\n    * immediately re-tokenize the source code (for that new module)\r\n        * If tokenization error, display error and cancel the rest of this download process\r\n        * if no tokenization error, perform the entire programming protocol on the module that the user selected. This means reset, identify, program, verify. Yes, the module will actually have been identified three times and programmed once through the processes of issues #138 and #139.\r\n\r\nSplit out from #139 "},"comment":{"url":"https://api.github.com/repos/parallaxinc/Parallax-IDE/issues/comments/121508342","html_url":"https://github.com/parallaxinc/Parallax-IDE/issues/166#issuecomment-121508342","issue_url":"https://api.github.com/repos/parallaxinc/Parallax-IDE/issues/166","id":121508342,"user":{"login":"PropGit","id":1266318,"avatar_url":"https://avatars.githubusercontent.com/u/1266318?v=3","gravatar_id":"","url":"https://api.github.com/users/PropGit","html_url":"https://github.com/PropGit","followers_url":"https://api.github.com/users/PropGit/followers","following_url":"https://api.github.com/users/PropGit/following{/other_user}","gists_url":"https://api.github.com/users/PropGit/gists{/gist_id}","starred_url":"https://api.github.com/users/PropGit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PropGit/subscriptions","organizations_url":"https://api.github.com/users/PropGit/orgs","repos_url":"https://api.github.com/users/PropGit/repos","events_url":"https://api.github.com/users/PropGit/events{/privacy}","received_events_url":"https://api.github.com/users/PropGit/received_events","type":"User","site_admin":false},"created_at":"2015-07-15T06:41:15Z","updated_at":"2015-07-15T06:41:15Z","body":"@drquinn the tokenizer fills in the TargetModule and TargetStart fields when compiling the code.  The TargetModule is a value 0 through 6 indicating the type of Stamp the code is targeting and the TargetStart indicates the character position within the source that the target module string starts.  The TargetStart treats the source like one long continuous string, where LF or CR is just another character rather than the end of a line.\r\n\r\nThe notes on this can be found in the [Using the PBASIC Tokenizer Library v1.2.pdf](https://drive.google.com/file/d/0B0tev9Y3WaL4SFF2c0NHdDZKd00/view?usp=sharing) document, page 5.  What I don't know is whether or not the wrapper API that Iced Dev made actually exposes both these fields or not.\r\n\r\nSo\r\n```\r\n'{$STAMP BS2}\r\n'{$PBASIC 2.5}\r\n```\r\nwould report a TargetModule of 2 and a TargetStart of 9.  For purposes of resolving this issue's feature, you have to know that 2 equates to the 3-character name \"BS2\" to remove those characters from the source (starting at character position 9) and replace them with the appropriate module identifier (which could be up to 5 characters in length; BS2, BS2e, BS2sx, BS2p, BS2pe).\r\n\r\nIf on the other hand the source was this\r\n```\r\n'{$PBASIC 2.5}\r\n'{$STAMP BS2}\r\n```\r\nthe tokenizer would report a TargetModule of 2 and a TargetStart of 24 (assuming the source uses single-character line endings).\r\n"}}