Skip to content

Commit 6861b9d

Browse files
Documentation fixes in stirng constraint generator
Updates in code point, add_axioms_for_constant, constraint for float add_axioms_from_float_scientific_notation, update add_axioms_for_empty_string. Xemove <tt> tag (does not seem supported by doxygen). Add documentation for associate_array_to_pointer, associate_length_to_array.
1 parent c410159 commit 6861b9d

5 files changed

+34
-19
lines changed

src/solvers/refinement/string_constraint_generator_code_points.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Author: Romain Brenguier, [email protected]
1616
/// code point to a utf-16 string
1717
/// \param res: array of characters corresponding to the result fo the function
1818
/// \param code_point: an expression representing a java code point
19-
/// \return an expression
19+
/// \return integer expression equal to zero
2020
exprt string_constraint_generatort::add_axioms_for_code_point(
2121
const array_string_exprt &res,
2222
const exprt &code_point)
@@ -113,7 +113,7 @@ exprt pair_value(exprt char1, exprt char2, typet return_type)
113113
}
114114

115115
/// add axioms corresponding to the String.codePointAt java function
116-
/// \par parameters: function application with two arguments: a string and an
116+
/// \param f: function application with arguments a string and an
117117
/// index
118118
/// \return a integer expression corresponding to a code point
119119
exprt string_constraint_generatort::add_axioms_for_code_point_at(
@@ -175,8 +175,8 @@ exprt string_constraint_generatort::add_axioms_for_code_point_before(
175175

176176
/// add axioms giving approximate bounds on the result of the
177177
/// String.codePointCount java function
178-
/// \par parameters: function application with three arguments: a string and two
179-
/// indexes
178+
/// \param f: function application with three arguments string `str`, integer
179+
/// `begin` and integer `end`.
180180
/// \return an integer expression
181181
exprt string_constraint_generatort::add_axioms_for_code_point_count(
182182
const function_application_exprt &f)
@@ -198,8 +198,8 @@ exprt string_constraint_generatort::add_axioms_for_code_point_count(
198198
/// add axioms giving approximate bounds on the result of the
199199
/// String.offsetByCodePointCount java function. We approximate the result by
200200
/// saying the result is between index + offset and index + 2 * offset
201-
/// \par parameters: function application with three arguments: a string and two
202-
/// indexes
201+
/// \param f: function application with arguments string `str`, integer `index`
202+
/// and integer `offset`.
203203
/// \return a new string expression
204204
exprt string_constraint_generatort::add_axioms_for_offset_by_code_point(
205205
const function_application_exprt &f)

src/solvers/refinement/string_constraint_generator_constants.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ Author: Romain Brenguier, [email protected]
1717

1818
/// add axioms saying the returned string expression should be equal to the
1919
/// string constant
20-
/// \par parameters: a string constant
21-
/// \return a string expression
20+
/// \param res: array of characters for the result
21+
/// \param sval: a string constant
22+
/// \return integer expression equal to zero
2223
exprt string_constraint_generatort::add_axioms_for_constant(
2324
const array_string_exprt &res,
2425
irep_idt sval)
@@ -52,8 +53,9 @@ exprt string_constraint_generatort::add_axioms_for_constant(
5253
}
5354

5455
/// add axioms to say that the returned string expression is empty
55-
/// \par parameters: function application without argument
56-
/// \return string expression
56+
/// \param f: function application with arguments integer `length` and character
57+
/// pointer `ptr`.
58+
/// \return integer expression equal to zero
5759
exprt string_constraint_generatort::add_axioms_for_empty_string(
5860
const function_application_exprt &f)
5961
{

src/solvers/refinement/string_constraint_generator_float.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ exprt estimate_decimal_exponent(const exprt &f, const ieee_float_spect &spec)
149149

150150
/// Add axioms corresponding to the String.valueOf(F) java function
151151
/// \param f: function application with one float argument
152-
/// \return a integer expression
152+
/// \return an integer expression
153153
exprt string_constraint_generatort::add_axioms_for_string_of_float(
154154
const function_application_exprt &f)
155155
{
@@ -169,12 +169,12 @@ exprt string_constraint_generatort::add_axioms_from_double(
169169
}
170170

171171
/// Add axioms corresponding to the integer part of m, in decimal form with no
172-
/// leading zeroes, followed by `'.'` (`'\\u002E'`), followed by one or more
173-
/// decimal digits representing the fractional part of m. This specification is
174-
/// correct for inputs that do not exceed 100000 and the function is unspecified
175-
/// for other values.
172+
/// leading zeroes, followed by &apos;.&apos;, followed by
173+
/// one or more decimal digits representing the fractional part of m.
174+
/// This specification is correct for inputs that do not exceed 100000 and the
175+
/// function is unspecified for other values.
176176
///
177-
/// TODO: this specification is not correct for negative numbers and
177+
/// \todo: this specification is not correct for negative numbers and
178178
/// double precision
179179
/// \param res: string expression corresponding to the result
180180
/// \param f: expression representing a float
@@ -474,7 +474,7 @@ exprt string_constraint_generatort::add_axioms_from_float_scientific_notation(
474474
/// Add axioms corresponding to the scientific representation of floating point
475475
/// values
476476
/// \param f: a function application expression
477-
/// \return code 0 on succes
477+
/// \return code 0 on success
478478
exprt string_constraint_generatort::add_axioms_from_float_scientific_notation(
479479
const function_application_exprt &f)
480480
{

src/solvers/refinement/string_constraint_generator_insert.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ exprt string_constraint_generatort::add_axioms_for_insert(
4848

4949
/// add axioms corresponding to the StringBuilder.insert(int, CharSequence) and
5050
/// StringBuilder.insert(int, CharSequence, int, int) java functions
51-
/// \par parameters: function application with three arguments: two strings and
52-
/// an index
51+
/// \param f: function application with arguments integer `|res|`, char pointer
52+
/// `&res[0]`, refined string `s1`, refined string `s2`,
53+
/// integer `offset`
5354
/// \return a new string expression
5455
exprt string_constraint_generatort::add_axioms_for_insert(
5556
const function_application_exprt &f)

src/solvers/refinement/string_constraint_generator_main.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ string_constraint_generatort::associate_char_array_to_char_pointer(
241241
return result;
242242
}
243243

244+
/// Associate a char array to a char pointer.
245+
/// Insert in `arrays_of_pointers_` a binding from `ptr` to `arr`.
246+
/// If the length of `arr` is infinite, we create a new integer symbol and add
247+
/// a binding from `arr` to this length in `length_of_array_`.
248+
/// This also adds the default axioms for `arr`.
249+
/// \param f: a function application with argument a character array `arr` and
250+
/// a character pointer `ptr`.
244251
exprt string_constraint_generatort::associate_array_to_pointer(
245252
const function_application_exprt &f)
246253
{
@@ -263,6 +270,11 @@ exprt string_constraint_generatort::associate_array_to_pointer(
263270
return from_integer(0, f.type());
264271
}
265272

273+
/// Associate an integer length to a char array.
274+
/// This adds an axiom ensuring that `arr.length` and `length` are equal.
275+
/// \param f: a function application with argument a character array `arr` and
276+
/// a integer `length`.
277+
/// \return integer expression equal to 0
266278
exprt string_constraint_generatort::associate_length_to_array(
267279
const function_application_exprt &f)
268280
{

0 commit comments

Comments
 (0)