summaryrefslogtreecommitdiff
path: root/op.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2018-01-12 12:00:30 +0000
committerDavid Mitchell <davem@iabyn.com>2018-01-19 13:45:20 +0000
commitc1048fcffff9a2b16ece33136c56febc7e5e4396 (patch)
tree14410bc416f113a61d6621f51978f53c363482b9 /op.h
parent5f63644886c09045a5d86d169abdfea9e804bce7 (diff)
downloadperl-c1048fcffff9a2b16ece33136c56febc7e5e4396.tar.gz
add two structs for OP_TRANS
Originally, the op_pv of an OP_TRANS op pointed to a 256-slot array of shorts, which contained the translations. However, in the presence of tr///c, extra information needs to be stored to handle utf8 strings. The 256 slot array was extended, with slot 0x100 holding a length, and slots 0x101 holding some extra chars. This has made things a bit messy, so this commit adds two structs, one being an array of 256 shorts, and the other being the same but with some extra fields. So for example tbl->[0x100] has been replaced with tbl->excess_len. This commit should make no functional difference, but will allow us shortly to fix a bug by changing the type of the excess_len field from short to something bigger, for example.
Diffstat (limited to 'op.h')
-rw-r--r--op.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/op.h b/op.h
index eb62c946fc..aeee339c14 100644
--- a/op.h
+++ b/op.h
@@ -627,6 +627,23 @@ typedef enum {
#define ref(o, type) doref(o, type, TRUE)
#endif
+
+/* basic and extended translation tables attached to OP_TRANS/OP_TRANSR ops */
+
+typedef struct {
+ short map[256];
+} OPtrans_map;
+
+/* used in the presence of tr///c to record any replacement chars that
+ * are paired with the implicit 0x100..0x7fffffff search chars */
+typedef struct {
+ short map[256];
+ short excess_len; /* number of entries in map_ex[] */
+ short repeat_char;
+ short map_ex[1]; /* Unwarranted chumminess */
+} OPtrans_map_ex;
+
+
/*
=head1 Optree Manipulation Functions