aboutsummaryrefslogtreecommitdiffstats
path: root/epan/ftypes/ftype-string.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2023-10-02 21:38:23 +0100
committerJoão Valverde <j@v6e.pt>2023-10-22 11:08:37 +0100
commit881dec9b90aec4e4c4b7ad25e86ee6b61eac4913 (patch)
treedba3bfcf9055911b12d2efbca34e384dc411f8cd /epan/ftypes/ftype-string.c
parentec669afcbb3fd71f3385fde6b9e384e75c7a1559 (diff)
dfilter: Add number lexical type
Add a lexical type for numbers, consisting of integers and floats. Because the float is represented internally as an IEEE 754 double and that is a lossy representation, we still need to parse numbers from strings sometimes. One sematic change instroduced is that integers on the RHS of a relation with bytes are interpreted as decimals instead of hexadecimals without a 0x prefix in the representation. This is a net win, in line with the goal of being explicit writing literal values in display filter expressions.
Diffstat (limited to 'epan/ftypes/ftype-string.c')
-rw-r--r--epan/ftypes/ftype-string.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c
index 28c33a7c95..a4faf0217a 100644
--- a/epan/ftypes/ftype-string.c
+++ b/epan/ftypes/ftype-string.c
@@ -208,10 +208,14 @@ ftype_register_string(void)
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
+ NULL, /* val_from_uinteger64 */
+ NULL, /* val_from_sinteger64 */
+ NULL, /* val_from_double */
string_to_repr, /* val_to_string_repr */
NULL, /* val_to_uinteger64 */
NULL, /* val_to_sinteger64 */
+ NULL, /* val_to_double */
{ .set_value_strbuf = string_fvalue_set_strbuf }, /* union set_value */
{ .get_value_strbuf = value_get }, /* union get_value */
@@ -244,10 +248,14 @@ ftype_register_string(void)
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
+ NULL, /* val_from_uinteger64 */
+ NULL, /* val_from_sinteger64 */
+ NULL, /* val_from_double */
string_to_repr, /* val_to_string_repr */
NULL, /* val_to_uinteger64 */
NULL, /* val_to_sinteger64 */
+ NULL, /* val_to_double */
{ .set_value_strbuf = string_fvalue_set_strbuf }, /* union set_value */
{ .get_value_strbuf = value_get }, /* union get_value */
@@ -280,10 +288,14 @@ ftype_register_string(void)
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
+ NULL, /* val_from_uinteger64 */
+ NULL, /* val_from_sinteger64 */
+ NULL, /* val_from_double */
string_to_repr, /* val_to_string_repr */
NULL, /* val_to_uinteger64 */
NULL, /* val_to_sinteger64 */
+ NULL, /* val_to_double */
{ .set_value_strbuf = string_fvalue_set_strbuf }, /* union set_value */
{ .get_value_strbuf = value_get }, /* union get_value */
@@ -316,10 +328,14 @@ ftype_register_string(void)
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
+ NULL, /* val_from_uinteger64 */
+ NULL, /* val_from_sinteger64 */
+ NULL, /* val_from_double */
string_to_repr, /* val_to_string_repr */
NULL, /* val_to_uinteger64 */
NULL, /* val_to_sinteger64 */
+ NULL, /* val_to_double */
{ .set_value_strbuf = string_fvalue_set_strbuf }, /* union set_value */
{ .get_value_strbuf = value_get }, /* union get_value */
@@ -352,10 +368,14 @@ ftype_register_string(void)
val_from_literal, /* val_from_literal */
val_from_string, /* val_from_string */
val_from_charconst, /* val_from_charconst */
+ NULL, /* val_from_uinteger64 */
+ NULL, /* val_from_sinteger64 */
+ NULL, /* val_from_double */
string_to_repr, /* val_to_string_repr */
NULL, /* val_to_uinteger64 */
NULL, /* val_to_sinteger64 */
+ NULL, /* val_to_double */
{ .set_value_strbuf = string_fvalue_set_strbuf }, /* union set_value */
{ .get_value_strbuf = value_get }, /* union get_value */