-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Move libfsm/start.c to Rust #344
base: main
Are you sure you want to change the base?
Move libfsm/start.c to Rust #344
Commits on Apr 20, 2021
-
3
Configuration menu - View commit details
-
Copy full SHA for 8d24c4f - Browse repository at this point
Copy the full SHA 8d24c4fView commit details -
Configuration menu - View commit details
-
Copy full SHA for a643036 - Browse repository at this point
Copy the full SHA a643036View commit details -
Configuration menu - View commit details
-
Copy full SHA for 00c33df - Browse repository at this point
Copy the full SHA 00c33dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9772089 - Browse repository at this point
Copy the full SHA 9772089View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6e05435 - Browse repository at this point
Copy the full SHA 6e05435View commit details -
Remove support for building shared libraries.
This is a shame, but gets in the way of porting to Rust.
Configuration menu - View commit details
-
Copy full SHA for 34e8b49 - Browse repository at this point
Copy the full SHA 34e8b49View commit details -
Configuration menu - View commit details
-
Copy full SHA for b572d09 - Browse repository at this point
Copy the full SHA b572d09View commit details -
Switch to ld -r linking the cargo-generated .a archive when producing…
… the partially linked .o files. This hopefully avoids an ld bug where `-undefined dynamic_lookup` doesn't work on MacOS, and also removes the need for programs to link both the C and Rust libraries directly.
Configuration menu - View commit details
-
Copy full SHA for bb83fd4 - Browse repository at this point
Copy the full SHA bb83fd4View commit details -
Replace bitfields in struct fsm_state and struct fsm with bool
C bitfields in Rust are painful, and I'd like something that has the same ABI as Rust's bool. stdbool.h's bool is just the thing. In both struct fsm_state and struct fsm: * All the bitfields are packed together. * The field that follows the bitfields is a pointer, so it has pointer alignment, so the overall size of the structs shouldn't change.
Configuration menu - View commit details
-
Copy full SHA for d0be59a - Browse repository at this point
Copy the full SHA d0be59aView commit details -
Start sketching types for State and Fsm
These come from internal.h. For now the Rust types have the same ABI as the C types; we'll have parallel structs for a while until all the internals get rustified.
Configuration menu - View commit details
-
Copy full SHA for 8fb687b - Browse repository at this point
Copy the full SHA 8fb687bView commit details -
The strategy for this commit: * Implement clear_start / set_start / get_start in Rust as methods, with argument checks as assertions. * Implement a C ABI wrapper to match the fsm_clearstart() / etc. functions. The non-null argument checks go there. * Test both sets of functions right there. We cannot construct a Fsm in Rust just yet, so the tests hack up just enough initial state for the code to run; this can be removed later. * Remove start.c. Later we can move all of the C API to a c_api.rs or whatever.
Configuration menu - View commit details
-
Copy full SHA for b4a98c2 - Browse repository at this point
Copy the full SHA b4a98c2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4277bb4 - Browse repository at this point
Copy the full SHA 4277bb4View commit details -
Hack in -lpthread -ldl everywhere needed
I really don't know the best way to do this with pmake; someone who knows better should fix this :)
Configuration menu - View commit details
-
Copy full SHA for 918798e - Browse repository at this point
Copy the full SHA 918798eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 84d60c7 - Browse repository at this point
Copy the full SHA 84d60c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 701f0fc - Browse repository at this point
Copy the full SHA 701f0fcView commit details
Commits on Apr 23, 2021
-
Configuration menu - View commit details
-
Copy full SHA for d2aab46 - Browse repository at this point
Copy the full SHA d2aab46View commit details -
Configuration menu - View commit details
-
Copy full SHA for 036d1eb - Browse repository at this point
Copy the full SHA 036d1ebView commit details -
state.c: Extract function to initialize a state
Instead of duplicating the code.
Configuration menu - View commit details
-
Copy full SHA for ce58305 - Browse repository at this point
Copy the full SHA ce58305View commit details -
fsm_addstate(): no need to initialize has_capture_actions in the real…
…loc block In all places where a state's .has_capture_actions gets accessed, there is an assert that the index of the state fits within the fsm->statecount. Since in the previous commit we initialize the has_capture_actions field when a new state is added, there is no need to initialize that field for all the as-yet-unused state structs in the realloc block.
Configuration menu - View commit details
-
Copy full SHA for 73cdd10 - Browse repository at this point
Copy the full SHA 73cdd10View commit details -
fsm_addstate(): Remove non-working test for statecount == -1
The -1 was meant to be an OOM sentinel, but there is no place in the code that actually sets fsm->statecount to -1 when the states array cannot be (re)allocated. The code after the patch does the realloc(), and properly returns a failure code if realloc() fails. I don't think we need to preserve setting "errno = ENOMEM" since there is no other place in the code that signals OOM through errno.
Configuration menu - View commit details
-
Copy full SHA for 8a5468c - Browse repository at this point
Copy the full SHA 8a5468cView commit details -
fsm_capture_init(): Initialize up to fsm->statecount fields, not the …
…whole statealloc Only the first statecount state structs are valid, anyway.
Configuration menu - View commit details
-
Copy full SHA for 840b847 - Browse repository at this point
Copy the full SHA 840b847View commit details