From 29479e2c50d41f29b5e21ffcb16416887aa693d2 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 30 Aug 2026 13:34:36 +0000 Subject: Remove APLWC_MIN_MEM constant, and APLWC_MEM environment variable FossilOrigin-Name: affcf2ab9c573820c77778abfb4769fad8a30ce457411b02a9528470994c7a6b --- src/include/aplwc.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/include') diff --git a/src/include/aplwc.h b/src/include/aplwc.h index 3061500..ad640e4 100644 --- a/src/include/aplwc.h +++ b/src/include/aplwc.h @@ -30,6 +30,4 @@ void aplwc_free_value(struct aplwc_value *); const char *aplwc_value_string(struct aplwc_value *); enum aplwc_rc aplwc_load_module(struct aplwc *, const char *, const char *, int n); -#define APLWC_MIN_MEM (64000) - #endif /* APLWC_H */ -- cgit v1.2.3 From 729964bea692f9683860978b89848784a7fc2f46 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 30 Aug 2026 20:52:43 +0000 Subject: Still a lot to be done, but I'm going to bed. Two remaining big issues: * aplwc (the parameter passed "everywhere") - should it move or not? * values returned from the public API should not move. FossilOrigin-Name: 31ab3154b8f3d5ac167218496e9e204324bf0ac9d36b7bada8fe2a6c8f93d51c --- src/include/aplwc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/aplwc.h b/src/include/aplwc.h index ad640e4..843fe42 100644 --- a/src/include/aplwc.h +++ b/src/include/aplwc.h @@ -18,7 +18,12 @@ struct aplwc; struct aplwc_line; struct aplwc_value; -enum aplwc_rc aplwc_new(struct aplwc **, uint8_t *, size_t); +struct aplwc_fns { + void *(*alloc)(size_t, size_t, size_t *); + void (*dealloc)(void *); +}; + +enum aplwc_rc aplwc_new(struct aplwc **, struct aplwc_fns); void aplwc_destroy(struct aplwc *); const char *aplwc_errstr_rc(enum aplwc_rc); const char *aplwc_errstr(struct aplwc *); -- cgit v1.2.3 From 7f7a2fb4fb23433e7be3d6953725690c8ea958d2 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 31 Aug 2026 19:44:56 +0000 Subject: The objects returned to the user are now integer-based references, not actual pointers. This means the aplwc internals can update those pointers without the user noticing. FossilOrigin-Name: 654c7d0ec85da295a7fb6ed381500410686b280f342fa81a30481f5e9a20c58a --- src/include/aplwc.h | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/include') diff --git a/src/include/aplwc.h b/src/include/aplwc.h index 843fe42..6ba2e35 100644 --- a/src/include/aplwc.h +++ b/src/include/aplwc.h @@ -15,24 +15,34 @@ enum aplwc_rc { }; struct aplwc; -struct aplwc_line; -struct aplwc_value; + +struct aplwc_ref { + struct aplwc *aplwc; + int id; +}; + +typedef struct { struct aplwc_ref ref; } AplwcLine; +typedef struct { struct aplwc_ref ref; } AplwcValue; struct aplwc_fns { void *(*alloc)(size_t, size_t, size_t *); void (*dealloc)(void *); }; -enum aplwc_rc aplwc_new(struct aplwc **, struct aplwc_fns); +struct aplwc *aplwc_new(struct aplwc_fns, enum aplwc_rc *); void aplwc_destroy(struct aplwc *); +void aplwc_clear_line(AplwcLine *); +void aplwc_clear_value(AplwcValue *); +int aplwc_valid_line(AplwcLine); +int aplwc_valid_value(AplwcValue); const char *aplwc_errstr_rc(enum aplwc_rc); const char *aplwc_errstr(struct aplwc *); enum aplwc_rc aplwc_last_error(struct aplwc *); -struct aplwc_line *aplwc_read(struct aplwc *, const char *); -void aplwc_free_line(struct aplwc_line *); -struct aplwc_value *aplwc_eval(struct aplwc_line *); -void aplwc_free_value(struct aplwc_value *); -const char *aplwc_value_string(struct aplwc_value *); +AplwcLine aplwc_read(struct aplwc *, const char *); +void aplwc_free_line(AplwcLine); +AplwcValue aplwc_eval(AplwcLine); +void aplwc_free_value(AplwcValue); +const char *aplwc_value_string(AplwcValue); enum aplwc_rc aplwc_load_module(struct aplwc *, const char *, const char *, int n); #endif /* APLWC_H */ -- cgit v1.2.3