source: trunk/src/check_files.m @ 277

Last change on this file since 277 was 277, checked in by gostiaux, 12 years ago

check_functions renamed
uvmat.m now checks the svn revision

File size: 8.4 KB
Line 
1%'check_files': check the path, modification date and svn version for all the
2%  function in the toolbox UVMAT. Called at the opening of uvmat. Adds the
3%  uvmat path to the Matlab path if needed.
4%----------------------------------------------------------------------
5% function [errormsg,date_str,ver]=check_files
6%
7% OUTPUT:
8% errormsg: error message listing functions whose paths are not in the directory of uvmat.m
9% date_str: date of the most recent modification of a file in the toolbox
10% ver : svn version in case this is a  svn repository
11
12%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
13%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
14%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
15%     This file is part of the toolbox UVMAT.
16%
17%     UVMAT is free software; you can redistribute it and/or modify
18%     it under the terms of the GNU General Public License as published by
19%     the Free Software Foundation; either version 2 of the License, or
20%     (at your option) any later version.
21%
22%     UVMAT is distributed in the hope that it will be useful,
23%     but WITHOUT ANY WARRANTY; without even the implied warranty of
24%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25%     GNU General Public License (file UVMAT/COPYING.txt) for more details.
26%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
27
28function [errormsg,date_str,svn_info]=check_files
29errormsg={};%default
30date_str='';
31svn_info.rep_rev=[];
32svn_info.cur_rev=[];
33list_fct={...
34    'calc_field';...% defines fields (velocity, vort, div...) from civx data and calculate them
35    'cell2tab';... %transform a Matlab cell in a character array suitable for display in a table
36    'check_field_structure';...% check the validity of the field struture representation consistant with the netcdf format
37    'check_functions';...
38    'civ';...   %function associated with the interface 'civ.fig' for PIV and spline interpolation
39    'civ.fig';...
40    'civ_3D';... function associated with the interface 'civ_3D.fig' for PIV in volume (in progress)
41    'civ_3D.fig';...
42    'civ_uvmat';...% civ programs, Matlab version (called by civ.m, option Civuvmat)
43    'close_fig';...% function  activated when a figure is closed
44    'copyfields';...% copy fields between two matlab structures
45    'create_grid';...% called by the GUI geometry_calib to create a physical grid
46    'create_grid.fig';...% GUI corresponding to create_grid.m
47    'dataview';...% function for scanning directories in a campaign
48    'dataview.fig';...% GUI corresponding to dataview
49    'delete_object';...%delete a projection object, defined by its index in the Uvmat list or by its graphic handle
50    'editxml';...%display and edit xml files using a xls schema
51    'editxml.fig';...%interface for editxml
52    'find_field_indices';...% group the variables of a nc-formated Matlab structure into 'fields' with common dimensions
53    'geometry_calib';...%performs geometric calibration from a set of reference points
54    'geometry_calib.fig';...%interface for geometry_calib
55    'get_field';...% choose and plot a field from a Netcdf file
56    'get_field.fig';...%interface for get_field
57    'griddata_uvmat';...%make 2D linear interpolation using griddata, with input appropriate for both Matlab 6.5 and 7
58    'hist_update';...%  update of a current global histogram by inclusion of a new field
59    'imadoc2struct';...%convert the image documentation file ImaDoc into a Matlab structure
60    'keyboard_callback';... % function activated when a key is pressed on the keyboard
61    'ListDir';... scan the structure of the directory tree (for dataview.m)
62    'mouse_down';% function activated when the mouse button is pressed on a figure (callback for 'WindowButtonDownFcn')
63    'mouse_motion';...% permanently called by mouse motion over a figure (callback for 'WindowButtonMotionFcn')
64    'mouse_up';... % function to be activated when the mouse button is released (callback for 'WindowButtonUpFcn')
65    'msgbox_uvmat';... associated with GUI msgbox_uvmat.fig to display message boxes, for error, warning or input calls
66    'msgbox_uvmat.fig';...
67    'name2display';...% extracts the root name and field numbers from an input filename
68    'name_generator';...%creates a file name from a root name and indices.
69    'nc2struct';...% transform a netcdf file in a corresponding matlab structure
70    'peaklock';...%
71    'phys_XYZ';...% transform coordiantes from pixels to phys
72    'pivlab';...% PIV program (Civ1), called by civ_uvmat
73    'px_XYZ';...% transform coordiantes from phys to pixels
74    'plot_field';...%displays a vector field and/or scalar or images
75    'plot_object';...%draws a projection object (points, line, plane...)
76    'proj_field';...%project a field on a projection object (plane, line,...)
77    'read_civxdata';...reads civx data from netcdf files
78    'read_imatext';...%read .civ files (obsolete, but can be adapted to other text documentation files)
79    'read_plot_param';... %read the plotting option parameters on the uvmat interface
80    'read_set_object';...%read the data on the set_object interface
81    'read_xls';...%read excel files containing the list of the experiments
82    'reinit';...% suppress the personal parameter file 'uvmat_perso.mat'
83    'RUN_STLIN';...% combine 2 displacement fields for stereo PIV
84    'series';...% master function for analysis field series, with interface 'series.fig'
85    'series.fig';...% interface for 'series'
86    'set_col_vec';...
87    'set_grid';...% creates a grid for PIV
88    'set_grid.fig';...% interface for set_grid
89    'set_object.m';...%  edit a projection object
90    'set_object.fig';...% interface for set_object
91    'sub_field';...% combine the two input fields,
92    'struct2nc';...% %write fields in netcdf files
93    'uvmat';...% master function for file scanning and visualisation of 2D fields
94    'uvmat.fig';...  %interface for uvmat
95    'update_imadoc';...  %update the ImaDoc xml file
96    'update_obj';... update the object representation graph and its projection field, record it in the uvmat interface
97    'update_waitbar';... update the waitbar display, used for ACTION functions in the GUI 'series'
98    'view_field.m';...% function for visualisation of projected fields'
99    'view_field.fig';...%GUI for view_field
100    'write_plot_param'...%update plotting parameters after plot
101    };
102dir_fct=which('uvmat');% path to uvmat
103[pathuvmat,name,ext]=fileparts(dir_fct);
104
105%% add the uvmat path to matlab if needed
106if isempty(regexp(path,[pathuvmat '(:|\>)'],'once'))
107    addpath(pathuvmat);
108end
109
110
111%% loop on the list of functions in the uvmat package
112
113icount=0;
114datnum=zeros(1,length(list_fct));
115for i=1:length(list_fct)
116    dir_fct=which(list_fct{i});% path to fct
117    if isempty(dir_fct)
118        icount=icount+1;
119        errormsg{icount}=[list_fct{i} ' not found'];% test for function not found
120    else
121        [pth,name,ext]=fileparts(dir_fct);
122        if ~isequal(pathuvmat,pth)&~isequal(fullfile(pathuvmat,'private'),pth)
123            icount=icount+1;
124            errormsg{icount}=[dir_fct ' overrides the package UVMAT'];% bad path for the function
125        end
126        datfile=dir(dir_fct);
127        if isfield(datfile,'datenum')
128            datnum(i)= datfile.datenum;
129        end
130        %        date_str=datfile.date;%string of the date of last modification
131        %        datnum(i)=0;%default
132        %        try
133        %            datnum(i)=datenum(date_str);
134        %        catch
135        %            datnum(i)=0;%in case of error with datenum (e.g. date in french)
136        %        end
137    end
138end
139date_str=datestr(max(datnum));
140
141[status,~]=system('svn --help');
142if status==0
143    [~,result]=system('svn info');
144    t=regexp(result,'R[eé]vision\s:\s(?<rev>\d+)','names');
145    svn_info.cur_rev=num2str(t.rev);
146    [~,result]=system('svn info -r ''HEAD''');
147    t=regexp(result,'R[eé]vision\s:\s(?<rev>\d+)','names');
148    svn_info.rep_rev=num2str(t.rev);
149    [~,result]=system('svn status');   
150    svn_info.status=result;
151end
152
153if svn_info.rep_rev>svn_info.cur_rev
154    errormsg {length(errormsg)+1}=['Repository now at revision ' num2str(svn_info.rep_rev) '. Please type svn update in uvmat folder'];
155end
156
157modifications=regexp(svn_info.status,'M\s[^(\n|\>)]+','match');
158
159if ~isempty(modifications)
160    for k=1:length(modifications)
161        errormsg {length(errormsg)+1}=modifications{k};
162    end
163end
164errormsg=errormsg';
Note: See TracBrowser for help on using the repository browser.