From 1d2ec29f472952c35da2cbdfd9993faff165e546 Mon Sep 17 00:00:00 2001 From: Matthew Dawson Date: Fri, 15 Jun 2012 15:03:32 +0000 Subject: [PATCH] Handle some multiline inputs. If there are multiple lines in an input box, it breaks various things. Fix that up by concating them together. Its a little better. git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/trunk/TableTool@8555 57e6efec-57d4-0310-aeb1-a6c144bb1a8b --- @CVC_checker/matlab_to_cvc_syntax_translation.m | 7 +++++++ @GUI/check_grid_condition.m | 6 ++++++ @GUI/check_matlab_syntax_condition.m | 1 + @GUI/evaluate_counter_grid.m | 7 +++++++ 4 files changed, 21 insertions(+) diff --git a/@CVC_checker/matlab_to_cvc_syntax_translation.m b/@CVC_checker/matlab_to_cvc_syntax_translation.m index 341c962..38dde35 100644 --- a/@CVC_checker/matlab_to_cvc_syntax_translation.m +++ b/@CVC_checker/matlab_to_cvc_syntax_translation.m @@ -12,6 +12,13 @@ % Author: Colin Eles elesc@mcmaster.ca % Organization: McMaster Centre for Software Certification function cvc_string = matlab_to_cvc_syntax_translation(matlab_string) + +s = [matlab_string(1,:)]; +for j = 2:size(matlab_string,1) + s = [s ' ' matlab_string(j,:)]; +end +matlab_string = s; + cvc_string = regexprep(matlab_string,'&&',' AND '); cvc_string = regexprep(cvc_string,'~(?!=)',' NOT '); cvc_string = regexprep(cvc_string,'~=',' /= '); diff --git a/@GUI/check_grid_condition.m b/@GUI/check_grid_condition.m index fa211fb..8b0fb7c 100644 --- a/@GUI/check_grid_condition.m +++ b/@GUI/check_grid_condition.m @@ -16,6 +16,12 @@ for i = 1:size(grid.cells,2) error = ''; string = get(grid.cells(i).cond,'String'); + + s = [string(1,:)]; + for j = 2:size(string,1) + s = [s ' ' string(j,:)]; + end + string = s; if ( strcmp(string,'') || isempty(string)) && i == 1 && isempty(grid.parent_grid) && size(grid.cells,2) == 1 break; diff --git a/@GUI/check_matlab_syntax_condition.m b/@GUI/check_matlab_syntax_condition.m index dc60283..78f40a2 100644 --- a/@GUI/check_matlab_syntax_condition.m +++ b/@GUI/check_matlab_syntax_condition.m @@ -28,6 +28,7 @@ for i=1:size(parsed_input,2) end + if ~result % the string is a condition we need to evaulate it as it % will be used in the code, as in order for an if statement diff --git a/@GUI/evaluate_counter_grid.m b/@GUI/evaluate_counter_grid.m index b8930df..c73c2ce 100644 --- a/@GUI/evaluate_counter_grid.m +++ b/@GUI/evaluate_counter_grid.m @@ -40,6 +40,13 @@ end check_string = [check_string counter sprintf('\n')]; for i=1:size(grid.cells,2) condition_string = get(grid.cells(i).cond,'string'); + + s = [condition_string(1,:)]; + for j = 2:size(condition_string,1) + s = [s ' ' condition_string(j,:)]; + end + condition_string = s; + if(~isempty(condition_string)) eval([check_string 'result =(' char(condition_string) ');']) -- GitLab