# Copyright 2012-2022 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } set SS "struct SimpleStruct" set SU "union SimpleUnion" set CS "struct ComplexStruct" set CU "union ComplexUnion" set enter_field_number_prompt {Enter the field number of choice: } set return_to_parent_prompt {Press enter to return to parent value: } set array_index_prompt {Enter the index of the element you want to explore in .*: } proc compound_description { value_name type_desc type_name } { return "The value of '$value_name' is a $type_desc of type '$type_name' with the following fields:\[\r\n\]+" } proc typedef_description { value_name typedef_name type_name } { return "The value of '$value_name' is of type '$typedef_name' which is a typedef of type '$type_name'\.\[\r\n\]+" } proc scalar_description { value_name type } { return "'$value_name' is a scalar value of type '$type'\.\[\r\n\]+" } proc array_description { value_name type } { return "'$value_name' is an array of '$type'\.\[\r\n\]+" } proc pointer_description { value_name type_name } { set type_description "'$value_name' is a pointer to a value of type '$type_name'\.\[\r\n\]+" set prompt "Continue exploring it as a pointer to a single value \[\[\]y/n\[\]\]: " return "$type_description$prompt" } proc field_values { args } { set result "" foreach field $args { set result "$result\[ \]*$field \[\.\]\[\.\] \[\(\]Value of type .*\[\)\]\[\r\n\]+" } return $result } proc field_choices { args } { set result "" set field_num 0 foreach field $args { set result "$result$field\[ \]+=\[ \]+