Complete batch 20261016-C-embedded-2: 45 verified GLM/Pi samples, independent regrades and archives; preserve difficulty misses and Salty blockage.
26 lines
798 B
C
26 lines
798 B
C
#ifndef HAL_INPUT_H
|
|
#define HAL_INPUT_H
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#define INPUT_LINE 4096u
|
|
#define INPUT_WORDS 128u
|
|
|
|
typedef struct {
|
|
char storage[INPUT_LINE];
|
|
char *words[INPUT_WORDS];
|
|
size_t count;
|
|
unsigned line;
|
|
unsigned failed;
|
|
} input_t;
|
|
|
|
void input_init(input_t *input);
|
|
int input_next(input_t *input, FILE *stream);
|
|
int input_count(const input_t *input, size_t count);
|
|
int input_u32(const input_t *input, size_t index, uint32_t maximum, uint32_t *value);
|
|
int input_unsigned(const input_t *input, size_t index, unsigned maximum, unsigned *value);
|
|
int input_byte(const input_t *input, size_t index, uint8_t *value);
|
|
int input_command(const input_t *input, const char *command);
|
|
void input_error(input_t *input, const char *message);
|
|
#endif
|