Major rework of API and improved documentation
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <decode.h>
|
||||
#include <fadec.h>
|
||||
|
||||
|
||||
static
|
||||
@@ -30,21 +30,7 @@ main(int argc, char** argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
DecodeMode mode;
|
||||
size_t mode_input = strtoul(argv[1], NULL, 0);
|
||||
if (mode_input == 32)
|
||||
{
|
||||
mode = DECODE_32;
|
||||
}
|
||||
else if (mode_input == 64)
|
||||
{
|
||||
mode = DECODE_64;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Unknown decode mode\n");
|
||||
return 1;
|
||||
}
|
||||
size_t mode = strtoul(argv[1], NULL, 0);
|
||||
|
||||
// Avoid allocation by transforming hex to binary in-place.
|
||||
uint8_t* code = (uint8_t*) argv[2];
|
||||
@@ -62,7 +48,7 @@ main(int argc, char** argv)
|
||||
struct timespec time_start;
|
||||
struct timespec time_end;
|
||||
|
||||
Instr instr;
|
||||
FdInstr instr;
|
||||
|
||||
__asm__ volatile("" : : : "memory");
|
||||
clock_gettime(CLOCK_MONOTONIC, &time_start);
|
||||
@@ -72,8 +58,8 @@ main(int argc, char** argv)
|
||||
while (current_off != length)
|
||||
{
|
||||
size_t remaining = length - current_off;
|
||||
int retval = decode(code + current_off, remaining, mode, 0x1234000,
|
||||
&instr);
|
||||
int retval = fd_decode(code + current_off, remaining, mode,
|
||||
0x1234000, &instr);
|
||||
if (retval < 0)
|
||||
goto fail;
|
||||
current_off += retval;
|
||||
@@ -83,7 +69,7 @@ main(int argc, char** argv)
|
||||
__asm__ volatile("" : : : "memory");
|
||||
|
||||
char format_buffer[128];
|
||||
instr_format(&instr, format_buffer);
|
||||
fd_format(&instr, format_buffer, sizeof(format_buffer));
|
||||
printf("%s\n", format_buffer);
|
||||
|
||||
if (repetitions > 1)
|
||||
|
||||
Reference in New Issue
Block a user