From a4930f91ced80d26758fae30f3e01eee7abe4345 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Sun, 7 Dec 2025 16:59:51 -0700 Subject: Add a couple different parameter types. fraction_t: semantically represents a value 0.0-1.0. Internally this is represented as a uint8 with 255 being 1 and 0 being 0. ratio_t: represents a fracitonal number that can be larger than 1.0. --- include/param.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/param.h') diff --git a/include/param.h b/include/param.h index 5259e0a..d0b5bf0 100644 --- a/include/param.h +++ b/include/param.h @@ -6,6 +6,8 @@ typedef struct httpd_req httpd_req_t; typedef uint32_t color_int_t; +typedef uint8_t fraction_t; +typedef uint16_t ratio_t; #define DECL_PARAMETER_INSTANCE(ty) \ void handle_option__##ty(const char* attr, sockbuf_t* sockbuf, ty* ptr); \ @@ -24,5 +26,7 @@ DECL_PARAMETER_INSTANCE(uint8_t); DECL_PARAMETER_INSTANCE(bool); DECL_PARAMETER_INSTANCE(uint32_t); DECL_PARAMETER_INSTANCE(color_int_t); +DECL_PARAMETER_INSTANCE(fraction_t); +DECL_PARAMETER_INSTANCE(ratio_t); DECL_PARAMETER_INSTANCE(int); DECL_PARAMETER_INSTANCE(int32_t); -- cgit