From bfb7b1ab9d2c85a256c42c006060ffe7c2652638 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 12 Mar 2025 16:40:07 +0100 Subject: Revert API change --- src/solvers/coord/common.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/solvers/coord/common.h') diff --git a/src/solvers/coord/common.h b/src/solvers/coord/common.h index d827665..f21a903 100644 --- a/src/solvers/coord/common.h +++ b/src/solvers/coord/common.h @@ -6,6 +6,7 @@ coord_t *all_coordinates[] = { STATIC void append_coord_name(const coord_t *, char *); STATIC coord_t *parse_coord(const char *, int); STATIC uint8_t parse_axis(const char *, int); +STATIC void parse_coord_and_axis(const char *, int, coord_t **, uint8_t *); STATIC void append_coord_name(const coord_t *coord, char *str) @@ -44,3 +45,19 @@ parse_axis(const char *axis, int n) return UINT8_ERROR; } + +STATIC void +parse_coord_and_axis(const char *str, int n, coord_t **coord, uint8_t *axis) +{ + int i; + + for (i = 0; i < n; i++) + if (str[i] == '_') + break; + + if (coord != NULL) + *coord = parse_coord(str, i); + + if (axis != NULL) + *axis = i == n ? UINT8_ERROR : parse_axis(str+i+1, n-i-1); +} -- cgit v1.3