Proposal: Commander ($) operator and utils.#77
Open
royeden wants to merge 5 commits intohundredrabbits:masterfrom
Open
Proposal: Commander ($) operator and utils.#77royeden wants to merge 5 commits intohundredrabbits:masterfrom
$) operator and utils.#77royeden wants to merge 5 commits intohundredrabbits:masterfrom
Conversation
…t orca commands from the UI in the same way as the Electron App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preface:
The other day I was watching this tutorial featured in the OrcaJS repo, and I found out that adjusting the BPM programmatically (as seen here) wasn't an option, so I decided to try and implement that, along with some of the other features from the commander interface.
I haven't programmed anything in C beyond some
"hello world"stuff (I come from a JS background) and this PR is the result of reverse engineering the really comprehensible code written in this repo + some web search 😄 .Changes:
Menu
Crtl + Gcommand to show operators.Implemented Orca
commanderinterface:State (
state.h):State*, it savesbpm,tick_num,is_playingand*oosc_dev(that one is still a TODO).* This abstraction was necessary to change
is_playingvia reference pointer (without abstracting the wholeGedstruct). It could still be implemented without struct nesting, changing the type ofis_playingtointand leaving everything inside of theGedstruct intact (this could maybe favor performance, but I don't know how much the performance is affected currently by passing a struct vs passing each value individually by reference).Commander (
commander.h,commander.c,sim.h,sim.c,cli_main.c,symisc.c):parse_command(Glyph command, State state)method. This implementation adds the following commands:play,run,stop,bpm:num,frame:num,rewind:numandskip:num. It usesstrtokto obtain tokens,strcmpto compare strings andstrtoulto parse number values.parse_commandmethod.orca_runnow takesstateas the only param related tobpm,tick_num,is_playingandoosc_dev.tool:
commander.cto avoid linking errors.Caveats and considerations:
Stateabstraction). This can be mitigated easily removing said abstraction and passing every single value by reference,skipcommand).