From 544b1fb6a70d55bf368b827136cf0f37a26e8288 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 7 Dec 2025 21:42:45 -0500 Subject: Change Paths to be an enum of their different types. --- src/stdlib/paths.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/stdlib/paths.h') diff --git a/src/stdlib/paths.h b/src/stdlib/paths.h index 677631b2..7a175099 100644 --- a/src/stdlib/paths.h +++ b/src/stdlib/paths.h @@ -12,6 +12,9 @@ Path_t Path$from_str(const char *str); Path_t Path$from_text(Text_t text); // int Path$print(FILE *f, Path_t path); +// UNSAFE: this works because each type of path has a .components in the same place +#define Path$components(path) ((path).components) +// END UNSAFE const char *Path$as_c_string(Path_t path); #define Path(str) Path$from_str(str) Path_t Path$_concat(int n, Path_t items[n]); @@ -69,5 +72,7 @@ bool Path$is_none(const void *obj, const TypeInfo_t *type); void Path$serialize(const void *obj, FILE *out, Table_t *pointers, const TypeInfo_t *type); void Path$deserialize(FILE *in, void *obj, List_t *pointers, const TypeInfo_t *type); +extern const TypeInfo_t Path$AbsolutePath$$info; +extern const TypeInfo_t Path$RelativePath$$info; +extern const TypeInfo_t Path$HomePath$$info; extern const TypeInfo_t Path$info; -extern const TypeInfo_t PathType$info; -- cgit v1.2.3