libhpcalcs: portable (Windows / MacOS X / Linux) connectivity kit library
|
12-29-2013, 11:03 AM
Post: #55
|
|||
|
|||
RE: libhpcalcs: portable (Windows / MacOS X / Linux) connectivity kit library
Thanks for the reminder. I had already thought of that feature request but forgot to add an item to the TODO list
I think that there are two steps in fulfilling that feature request: Step 1: base functionality: 1) adding support for a "send_keys" operation, hpcalcs_calc_send_keys() and backends; 2) in test_hpcalcs, using strtok (once for initialization, then in a loop until NULL is returned), then for each token, strtoul with base 0 on each token (breaking upon error and upon invalid key code) to incrementally build an array of key codes, before passing that array to hpcalcs_calc_send_keys(); Level 2: refinements taking more time and left for future work: 1) adding a header file containing 4 * 51 definitions for the key codes (will take a bit of effort); 2) add an array of structs containing at least the key ID and the key name, stringified from the definition. 3) add a sorting functions by string name, so that binary search can be used; 4) add a key searching function, which parses the input string using strtoul with base 0, then if that fails, searches by string name into the sorted array, and returns a key ID or error; 5) use the key searching function in test_hpcalcs. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)