summaryrefslogtreecommitdiffstats
path: root/struct.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-21 06:55:45 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-21 06:55:45 -0700
commit16ea370778dcd9943fb11767992aebf6263acfd4 (patch)
tree02f66ea406e46eb7571a27ab6a4b3510d24fe05f /struct.h
parent5613a3b0d42a89d061df18cd9ae4e1008696572c (diff)
downloadtxr-16ea370778dcd9943fb11767992aebf6263acfd4.tar.gz
txr-16ea370778dcd9943fb11767992aebf6263acfd4.tar.bz2
txr-16ea370778dcd9943fb11767992aebf6263acfd4.zip
compat: fix glaringly broken init-time handling.
We are doing numerous compat_ver checks in various init functions, to enact alternative symbol registrations. Only problem is, compat_ver is always zero during initialization; it is not set until the -C option is processed in txr_main. Registrations must be fixed up after initialization; that's what the compat_fixup mechanism is for. This is an long-standing problem which affects compatibility operation going back over 150 versions. * arith.c (arith_init): Move compat logic to arith_compat_fixup. (arith_compat_fixup): New function. * arith.h (arith_compat_fixup): Declared. * eval.c (eval_init): Move compat logic to eval_compat_fixup. * ffi.c (ffi_init): Move compat logic to ffi_compat_fixup. (ffi_compat_fixup): New function. * ffi.h (ffi_compat_fixup): Declared. * regex.c (regex_init): Move compat logic to regex_compat_fixup. (regex_compat_fixup): New function. * regex.h (regex_compat_fixup): Declared. * stream.c (stream_init): Move compat logic to stream_compat_fixup. (stream_compat_fixup): New function. * stream.h (stream_compat_fixup): Declared. * struct.c (struct_init): Move compat logic to struct_compat_fixup. (struct_compat_fixup): New function. * struct.h (stream_compat_fixup): Declared. * lib.c (compat_fixup): Call arith_compat_fixup, ffi_compat_fixup, regex_compat_fixup, stream_compat_fixup and struct_compat_fixup.
Diffstat (limited to 'struct.h')
-rw-r--r--struct.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/struct.h b/struct.h
index 6b139653..3549f7bf 100644
--- a/struct.h
+++ b/struct.h
@@ -95,3 +95,4 @@ val get_special_required_slot(val obj, enum special_slot spidx);
val get_special_slot_by_type(val stype, enum special_slot spidx);
INLINE int obj_struct_p(val obj) { return obj->co.ops == &struct_inst_ops; }
void struct_init(void);
+void struct_compat_fixup(int compat_ver);