Commit 5518b07d authored by Colin Eles's avatar Colin Eles
Browse files

found bug in checking for imports now checks results grid as well

git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/trunk/TableTool@7025 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parent 62b35c3f
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -16,11 +16,48 @@ function string = pvs_check_for_imports(object)
[string,found] = object.pvs_check_for_imports_g(object.data.Grid2,{});
[string2,found2] = object.pvs_check_for_imports_g(object.data.Grid1,found);





% check for imports in the inputs field



hashtable = {{'sqrt', 'reals@sqrt'} {'sin', 'trig@trig_basic'} {'cos', 'trig@trig_basic'} {'tan', 'trig@trig_basic'}};

% check for imports in the results grid.
for i=1:size(object.data.Grid0.Cells,2)

    text = char(object.data.Grid0.Cells(i).result_text);
    
    vars = regexp(text,'([a-zA-Z][a-zA-Z0-9_]*)','match');
    
    
    
    
    for j=1:size(vars,2)
        if(exist(vars{j},'file')==2 && ~strcmp(vars{j},'otherwise'))
            %check if already imported file
            if (~any(ismember(found,vars{j})))
                string = [string 'IMPORTING ' vars{j} sprintf('\n')];
                found = [found vars{j}];
            end
        end
        
        for k=1:size(hashtable,2)
            if strcmp(vars{j},hashtable{k}(1))
                if (~any(ismember(found,vars{j})))
                string = [string 'IMPORTING ' char(hashtable{k}(2)) sprintf('\n')];
                found = [found vars{j}];
                end
            end    
        end
    end
end



for k=1:size(hashtable,2)
    
    functions = regexp(char(object.data.function_inputs),hashtable{k}(1),'once')