Changes the `APDU` struct into a builder for serialized APDU messages.
This makes APDU construction safer and more idiomatic, and also caught a
few bugs in the process (missing templ from the C translation).
There was originally another `Error` type from the translation. Now that
it's gone, and we don't presently have a type just named `Error`, this
renames the current `ErrorKind` type now that the original was deleted.
Switches all of the previous `state->verbose`-gated `eprintln!` calls to
use macros from the `log` crate, trying to map them onto the previous
verbosity levels, more or less following this mapping:
0. off
1. error/info/warn (depending on context)
2. trace
This additionally includes a bunch of logic/branch reformatting (and
occasional missed constants), since getting rid of all the gating on
verbose provided ample opportunities to clean up the code. Hopefully I
didn't break too much in the process!
Uses GitHub Actions for CI, based on the `actions-rs` template:
<https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md>
Configured to run tests on Linux (Ubuntu), macOS, and Windows, all of
which we should theoretically be able to support via appropriately
portable PC/SC Rust crates.
This repository contains the entire history of the C source code since
the project started.
However, the code is largely translated at this point, so keeping the C
code around at this point no longer makes sense. If we need to consult
it or the history of changes, git has them.
This commit gets the Rust code to compile! 🎉
Additionally, it fixes all of the commented out code that was failing
translation from C due to the use of unions, namely around the APDU
messages.
It does a fair amount of reformatting around branches, with the net
result hopefully being something actually a bit closer to the C code,
and a straightforward list of `if` statements.
It also removes all of the remaining externs that aren't supposed to be
externs, replacing them with a more straightforward usage of the module
system.
Finally it fixes all errors and warnings (relating to e.g. usage of
uninitialized memory), in addition to most clippy lints! (some have
been explicitly disabled)
All that said, it still doesn't do anything: it needs to be wired up to
a PCSC library first before that will be possible. But hey, it compiles!
This commit contains a multitude of fixes and some initial translation
work so the first rustc pass compiles.
It removes `unsafe extern "C"` declarations, so now there are a number
of errors about invocations of unsafe functions that need to be
addressed. They should each be scoped to an `unsafe` block so as to aid
in an eventual safe translation.
Some of the functions are now using the module system rather than
`extern "C"` bindings, but the translation is not complete.