diff --git a/matlab/reports/@section/addSection.m b/matlab/reports/@elements/addGraph.m
similarity index 80%
rename from matlab/reports/@section/addSection.m
rename to matlab/reports/@elements/addGraph.m
index fab549127..5149e3f1e 100644
--- a/matlab/reports/@section/addSection.m
+++ b/matlab/reports/@elements/addGraph.m
@@ -1,5 +1,5 @@
-function ss = addSection(ss, varargin)
-% function ss = addSection(ss, varargin)
+function e = addGraph(e, varargin)
+% function e = addGraph(e, varargin)
% Copyright (C) 2013 Dynare Team
%
@@ -20,8 +20,8 @@ function ss = addSection(ss, varargin)
assert(nargin >= 1 && nargin <= 3)
if nargin == 1
- ss.objArray = ss.objArray.addObj(section());
+ e.objArray = e.objArray.addObj(graph());
else
- ss.objArray = ss.objArray.addObj(varargin{:});
+ e.objArray = e.objArray.addObj(varargin{:});
end
end
\ No newline at end of file
diff --git a/matlab/reports/@elements/addTable.m b/matlab/reports/@elements/addTable.m
new file mode 100644
index 000000000..6fe074dee
--- /dev/null
+++ b/matlab/reports/@elements/addTable.m
@@ -0,0 +1,27 @@
+function e = addTable(e, varargin)
+% function e = addTable(e, varargin)
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(nargin >= 1 && nargin <= 3)
+if nargin == 1
+ e.objArray = e.objArray.addObj(table());
+else
+ e.objArray = e.objArray.addObj(varargin{:});
+end
+end
\ No newline at end of file
diff --git a/matlab/reports/@elements/display.m b/matlab/reports/@elements/display.m
new file mode 100644
index 000000000..9f6348c21
--- /dev/null
+++ b/matlab/reports/@elements/display.m
@@ -0,0 +1,36 @@
+function display(o)
+%function display(o)
+% Display a Elements object
+%
+% INPUTS
+% none
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+name = 'report.page.section.elements';
+disp(' ');
+disp([name ' = ']);
+disp(' ');
+disp(getElements(o));
+end
\ No newline at end of file
diff --git a/matlab/reports/@elements/elements.m b/matlab/reports/@elements/elements.m
new file mode 100644
index 000000000..e6ca1a315
--- /dev/null
+++ b/matlab/reports/@elements/elements.m
@@ -0,0 +1,42 @@
+function e = elements(varargin)
+%function e = elements(varargin)
+% Elements Class Constructor
+%
+% INPUTS
+% Optional elements object
+%
+% OUTPUTS
+% elements object
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+switch nargin
+ case 0
+ e = class(struct, 'elements', objArray());
+ case 1
+ assert(isa(varargin{1}, 'elements'), ...
+ ['With one arg to elements constructor, you must pass an ' ...
+ 'elements object or a char.']);
+ e = varargin{1};
+ otherwise
+ error('Elements constructor: invalid number of arguments');
+end
+end
\ No newline at end of file
diff --git a/matlab/reports/@section/getSections.m b/matlab/reports/@elements/getElements.m
similarity index 85%
rename from matlab/reports/@section/getSections.m
rename to matlab/reports/@elements/getElements.m
index e60f2270d..550c1af69 100644
--- a/matlab/reports/@section/getSections.m
+++ b/matlab/reports/@elements/getElements.m
@@ -1,5 +1,5 @@
-function e = getSections(ss, varargin)
-% function e = getSections(ss, varargin)
+function e = getElements(ps, varargin)
+% function e = getElements(ps, varargin)
% Copyright (C) 2013 Dynare Team
%
@@ -18,5 +18,5 @@ function e = getSections(ss, varargin)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-e = ss.objArray.getObjs(varargin{:});
+e = ps.objArray.getObjs(varargin{:});
end
\ No newline at end of file
diff --git a/matlab/reports/@section/numSections.m b/matlab/reports/@elements/numElements.m
similarity index 88%
rename from matlab/reports/@section/numSections.m
rename to matlab/reports/@elements/numElements.m
index 006f4f2bf..c31842037 100644
--- a/matlab/reports/@section/numSections.m
+++ b/matlab/reports/@elements/numElements.m
@@ -1,5 +1,5 @@
-function ns = numSections(ss)
-% function ns = numSections(ss)
+function n = numElements(o)
+% function n = numElements(o)
% Copyright (C) 2013 Dynare Team
%
@@ -18,5 +18,5 @@ function ns = numSections(ss)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-ns = ss.objArray.numObjs();
+n = o.objArray.numObjs();
end
\ No newline at end of file
diff --git a/matlab/reports/@elements/subsasgn.m b/matlab/reports/@elements/subsasgn.m
new file mode 100644
index 000000000..878a5ee15
--- /dev/null
+++ b/matlab/reports/@elements/subsasgn.m
@@ -0,0 +1,39 @@
+function B = subsasgn(A, S, V)
+% function B = subsasgn(A, S, V)
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+B = A;
+if length(S) > 1
+ for i=1:(length(S)-1)
+ B = subsref(B, S(i));
+ end
+ B = subsasgn(B, S(end), V);
+ B = subsasgn(A, S(1:(end-1)), B);
+ return
+end
+
+switch S.type
+ case '()'
+ index = S.subs{:};
+ assert(isnumeric(index));
+ B.objArray(index) = V;
+ otherwise
+ error('Elements subsasign syntax error')
+end
+end
\ No newline at end of file
diff --git a/matlab/reports/@elements/subsref.m b/matlab/reports/@elements/subsref.m
new file mode 100644
index 000000000..d1dac4c8a
--- /dev/null
+++ b/matlab/reports/@elements/subsref.m
@@ -0,0 +1,48 @@
+function A = subsref(A, S)
+%function A = subsref(A, S)
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+switch S(1).type
+ case '.'
+ switch S(1).subs
+ case fieldnames(A)
+ A = A.(S(1).subs);
+ case methods(A)
+ if areParensNext(S)
+ A = feval(S(1).subs, A, S(2).subs{:});
+ S = shiftS(S);
+ else
+ A = feval(S(1).subs, A);
+ end
+ otherwise
+ error(['Elements Class: unknown field or method: ' S(1).subs]);
+ end
+ case '()'
+ A = getElements(A, S(1).subs{:});
+ case '{}'
+ error(['Elements Class: ' S(1).type ' indexing not supported.']);
+ otherwise
+ error('Elements Class: subsref.m impossible case')
+end
+
+S = shiftS(S);
+if length(S) >= 1
+ A = subsref(A, S);
+end
+end
diff --git a/matlab/reports/@graph/display.m b/matlab/reports/@graph/display.m
new file mode 100644
index 000000000..f9f9d82fc
--- /dev/null
+++ b/matlab/reports/@graph/display.m
@@ -0,0 +1,46 @@
+function display(o)
+%function display(o)
+% Display a Graph object
+%
+% INPUTS
+% none
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+name = 'report.page.section.graph';
+disp(' ');
+disp([name '.caption = ']);
+disp(' ');
+disp([' ''' o.caption '''']);
+
+disp(' ');
+disp([name '.footnote = ']);
+disp(' ');
+disp([' ''' o.footnote '''']);
+
+disp(' ');
+disp([name '.filename = ']);
+disp(' ');
+disp([' ''' o.filename '''']);
+end
\ No newline at end of file
diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m
new file mode 100644
index 000000000..48ed3501a
--- /dev/null
+++ b/matlab/reports/@graph/graph.m
@@ -0,0 +1,66 @@
+function o = graph(varargin)
+%function o = graph(varargin)
+% Graph Class Constructor
+%
+% INPUTS
+% 0 args => empty graph
+% 1 arg (graph class) => copy object
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+o = struct;
+o.caption = '';
+o.footnote = '';
+o.filename = '';
+o.data = '';
+o.config = '';
+
+if nargin == 1
+ assert(isa(varargin{1}, 'graph'),['With one arg to Graph constructor, ' ...
+ 'you must pass a graph object']);
+ o = varargin{1};
+ return;
+elseif nargin > 1
+ if round(nargin/2) ~= nargin/2
+ error(['Options to Graph constructor must be supplied in name/value ' ...
+ 'pairs.']);
+ end
+
+ optNames = lower(fieldnames(o));
+
+ % overwrite default values
+ for pair = reshape(varargin, 2, [])
+ field = lower(pair{1});
+ if any(strmatch(field, optNames, 'exact'))
+ o.(field) = pair{2};
+ else
+ error('%s is not a recognized option to the Graph constructor.', ...
+ field);
+ end
+ end
+end
+
+% Create graph object
+o = class(o, 'graph');
+end
\ No newline at end of file
diff --git a/matlab/reports/@graph/subsasgn.m b/matlab/reports/@graph/subsasgn.m
new file mode 100644
index 000000000..deef33b82
--- /dev/null
+++ b/matlab/reports/@graph/subsasgn.m
@@ -0,0 +1,42 @@
+function B = subsasgn(A, S, V)
+% function B = subsasgn(A, S, V)
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+B = A;
+if length(S) > 1
+ for i=1:(length(S)-1)
+ B = subsref(B, S(i));
+ end
+ B = subsasgn(B, S(end), V);
+ B = subsasgn(A, S(1:(end-1)), B);
+ return
+end
+
+switch S.type
+ case '.'
+ switch S.subs
+ case fieldnames(A)
+ B.(S.subs) = V;
+ otherwise
+ error(['field ' S.subs 'does not exist in the page class'])
+ end
+ otherwise
+ error('report subsasign syntax error')
+end
+end
\ No newline at end of file
diff --git a/matlab/reports/@graph/subsref.m b/matlab/reports/@graph/subsref.m
new file mode 100644
index 000000000..01a57c6eb
--- /dev/null
+++ b/matlab/reports/@graph/subsref.m
@@ -0,0 +1,46 @@
+function A = subsref(A, S)
+%function A = subsref(A, S)
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+switch S(1).type
+ case '.'
+ switch S(1).subs
+ case fieldnames(A)
+ A = A.(S(1).subs);
+ case methods(A)
+ if areParensNext(S)
+ A = feval(S(1).subs, A, S(2).subs{:});
+ S = shiftS(S);
+ else
+ A = feval(S(1).subs, A);
+ end
+ otherwise
+ error(['Graph Class: unknown field or method: ' S(1).subs]);
+ end
+ case {'()', '{}'}
+ error(['Graph Class: ' S(1).type ' indexing not supported.']);
+ otherwise
+ error('Graph Class: subsref.m impossible case')
+end
+
+S = shiftS(S);
+if length(S) >= 1
+ A = subsref(A, S);
+end
+end
diff --git a/matlab/reports/@graph/write.m b/matlab/reports/@graph/write.m
new file mode 100644
index 000000000..4ad52ff8c
--- /dev/null
+++ b/matlab/reports/@graph/write.m
@@ -0,0 +1,40 @@
+function write(o, fid, texIndent)
+%function write(o, fid)
+% Write a Page object
+%
+% INPUTS
+% none
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(fid > 0);
+assert(isnumeric(texIndent));
+
+fprintf(fid, '%d\% Page Object\n', texIndent);
+fprintf(fid, '%d\newpage\n', texIndent);
+
+o.sections.write(fid, texIndent+2);
+
+fprintf(fid, '%d\% End Page Object\n', texIndent);
+end
\ No newline at end of file
diff --git a/matlab/reports/@page/addSection.m b/matlab/reports/@page/addSection.m
index 4ad61a26b..c9855ae3a 100644
--- a/matlab/reports/@page/addSection.m
+++ b/matlab/reports/@page/addSection.m
@@ -8,7 +8,7 @@ function p = addSection(p, varargin)
% 3 args => add section at index
%
% OUTPUTS
-% updated report object
+% updated page object
%
% SPECIAL REQUIREMENTS
% none
diff --git a/matlab/reports/@page/page.m b/matlab/reports/@page/page.m
index ded4d5d27..f0988d571 100644
--- a/matlab/reports/@page/page.m
+++ b/matlab/reports/@page/page.m
@@ -1,5 +1,5 @@
-function p = page(varargin)
-%function p = page(varargin)
+function o = page(varargin)
+%function o = page(varargin)
% Page Class Constructor
%
% INPUTS
@@ -29,17 +29,36 @@ function p = page(varargin)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-p = struct;
-p.sections = sections();
+o = struct;
+o.caption = '';
+o.orientation = 'portrait';
+o.sections = sections();
-switch nargin
- case 0
- p = class(p, 'page');
- case 1
- assert(isa(varargin{1}, 'page'), ['Page constructor: the only valid ' ...
- 'arguments are page objects']);
- p = varargin{1};
- otherwise
- error('Page constructor: invalid number of arguments');
+if nargin == 1
+ assert(isa(varargin{1}, 'page'),['With one arg to Page constructor, ' ...
+ 'you must pass a page object']);
+ o = varargin{1};
+ return;
+elseif nargin > 1
+ if round(nargin/2) ~= nargin/2
+ error(['Options to Page constructor must be supplied in name/value ' ...
+ 'pairs.']);
+ end
+
+ optNames = lower(fieldnames(o));
+
+ % overwrite default values
+ for pair = reshape(varargin, 2, [])
+ field = lower(pair{1});
+ if any(strmatch(field, optNames, 'exact'))
+ o.(field) = pair{2};
+ else
+ error('%s is not a recognized option to the Page constructor.', ...
+ field);
+ end
+ end
+end
+
+% Create page object
+o = class(o, 'page');
end
-end
\ No newline at end of file
diff --git a/matlab/reports/@page/subsref.m b/matlab/reports/@page/subsref.m
index 7b3826bb9..33524ac79 100644
--- a/matlab/reports/@page/subsref.m
+++ b/matlab/reports/@page/subsref.m
@@ -23,6 +23,13 @@ switch S(1).type
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
+ case {'write'}
+ if areParensNext(S)
+ write(A, S(2).subs{:})
+ S = shiftS(S);
+ else
+ assert(false);
+ end
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
diff --git a/matlab/reports/@page/write.m b/matlab/reports/@page/write.m
new file mode 100644
index 000000000..515a8b819
--- /dev/null
+++ b/matlab/reports/@page/write.m
@@ -0,0 +1,44 @@
+function write(o, fid, indent)
+%function write(o, fid, indent)
+% Write a Page object
+%
+% INPUTS
+% fid - int, file id
+% indent - char, number of spaces to indent tex code
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(fid ~= -1);
+
+fprintf(fid, '\n%s%% Page Object\n', indent);
+if strcmpi(o.orientation, 'landscape')
+ fprintf(fid, '%s\\begin{landscape}\n', indent);
+end
+o.sections.write(fid, addIndentation(indent));
+if strcmpi(o.orientation, 'landscape')
+ fprintf(fid, '%s\\end{landscape}\n', indent);
+end
+fprintf(fid, '%s\\clearpage\n', indent);
+fprintf(fid, '%s%% End Page Object\n\n', indent);
+end
\ No newline at end of file
diff --git a/matlab/reports/@pages/subsasgn.m b/matlab/reports/@pages/subsasgn.m
index 1916c1a5c..d99e0695f 100644
--- a/matlab/reports/@pages/subsasgn.m
+++ b/matlab/reports/@pages/subsasgn.m
@@ -34,6 +34,6 @@ switch S.type
assert(isnumeric(index));
B.objArray(index) = V;
otherwise
- error('objArray subsasign syntax error')
+ error('Pages subsasign syntax error');
end
end
\ No newline at end of file
diff --git a/matlab/reports/@pages/subsref.m b/matlab/reports/@pages/subsref.m
index 8d78e5c26..1e5db0297 100644
--- a/matlab/reports/@pages/subsref.m
+++ b/matlab/reports/@pages/subsref.m
@@ -23,6 +23,13 @@ switch S(1).type
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
+ case {'write'}
+ if areParensNext(S)
+ write(A, S(2).subs{:})
+ S = shiftS(S);
+ else
+ assert(false);
+ end
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
diff --git a/matlab/reports/@pages/write.m b/matlab/reports/@pages/write.m
new file mode 100644
index 000000000..8bb89e368
--- /dev/null
+++ b/matlab/reports/@pages/write.m
@@ -0,0 +1,39 @@
+function write(o, fid, indent)
+%function write(o, fid, indent)
+% Write Pages object
+%
+% INPUTS
+% fid - int, file id
+% indent - char, number of spaces to indent tex code
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(fid ~= -1);
+fprintf(fid, '\n%s%% Pages Object\n', indent);
+nps = numPages(o);
+for i=1:nps
+ o.objArray(i).write(fid, addIndentation(indent));
+end
+fprintf(fid, '%s%% End Pages Object\n\n', indent);
+end
\ No newline at end of file
diff --git a/matlab/reports/@report/display.m b/matlab/reports/@report/display.m
index 9ed363ced..5c1f47148 100644
--- a/matlab/reports/@report/display.m
+++ b/matlab/reports/@report/display.m
@@ -33,14 +33,32 @@ disp(' ');
disp([name '.title = ']);
disp(' ');
disp([' ''' o.title '''']);
+
+disp(' ')
+disp([name '.paper = ']);
+disp(' ');
+disp([' ''' o.paper '''']);
+
disp(' ')
disp([name '.orientation = ']);
disp(' ');
disp([' ''' o.orientation '''']);
+
+disp(' ')
+disp([name '.filename = ']);
+disp(' ');
+disp([' ''' o.filename '''']);
+
+disp(' ')
+disp([name '.config = ']);
+disp(' ');
+disp([' ''' o.config '''']);
+
disp(' ')
disp([name '.numPages() = ']);
disp(' ');
disp([' ' num2str(numPages(o))]);
+
disp(' ');
disp([name '.pages = ']);
disp(' ');
diff --git a/matlab/reports/@report/private/validateOrientation.m b/matlab/reports/@report/private/validateOrientation.m
index 91927669b..98683c36c 100644
--- a/matlab/reports/@report/private/validateOrientation.m
+++ b/matlab/reports/@report/private/validateOrientation.m
@@ -1,5 +1,5 @@
-function orientation = validateOrientation(orientation)
-%function orientation = validateOrientation(orientation)
+function validateOrientation(orientation)
+%function validateOrientation(orientation)
% Validate orientation string
%
% INPUTS
@@ -28,8 +28,6 @@ function orientation = validateOrientation(orientation)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-assert(any(strcmpi(orientation, {'portrait', 'landscape'})), ...
- ['Valid orientation arguments are: ''portrait'' and ' ...
- '''landscape''.']);
-orientation = lower(orientation);
+assert(any(strcmpi(orientation, {'portrait', 'landscape'})), ['Valid ' ...
+ 'orientation arguments are: ''portrait'' and ''landscape''.']);
end
\ No newline at end of file
diff --git a/matlab/reports/@report/private/validatePaper.m b/matlab/reports/@report/private/validatePaper.m
new file mode 100644
index 000000000..0395db76f
--- /dev/null
+++ b/matlab/reports/@report/private/validatePaper.m
@@ -0,0 +1,33 @@
+function validatePaper(paper)
+%function validatePaper(paper)
+% Validate paper string
+%
+% INPUTS
+% char : paper size
+%
+% OUTPUTS
+% char : lowercase paper
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(any(strcmpi(paper, {'a4', 'letter'})), ['Valid paper arguments ' ...
+ 'are: ''a4'' and ''letter''.']);
+end
\ No newline at end of file
diff --git a/matlab/reports/@report/report.m b/matlab/reports/@report/report.m
index cb5cd11fa..e4e193abd 100644
--- a/matlab/reports/@report/report.m
+++ b/matlab/reports/@report/report.m
@@ -1,13 +1,10 @@
-function r = report(varargin)
-%function r = report(varargin)
+function o = report(varargin)
+%function o = report(varargin)
% Report Class Constructor
%
% INPUTS
-% 0 args => no title, portrait orientation
-% 1 arg (report class) => copy class
-% 1 arg (not report class) => title
-% 2 args (1st not report class) => title, orientation
-% 3 args (1st not report class) => title, orientation, configuraiton
+% 1 report class object => make a copy
+% Otherwise, option/value pairs (see structure below for options)
%
% OUTPUTS
% none
@@ -33,51 +30,44 @@ function r = report(varargin)
% along with Dynare. If not, see .
% default values
-r = struct;
-r.title = '';
-r.orientation = 'portrait';
-r.pages = pages();
-r.config = '';
+o = struct;
+o.title = '';
+o.orientation = 'portrait';
+o.paper = 'a4';
+o.pages = pages();
+o.filename = 'report.tex';
+o.config = '';
-% Check arguments
if nargin == 1
- assert(isa(varargin{1}, 'report') || ischar(varargin{1}), ...
- ['With one arg to report constructor, you must pass either '...
- 'a report object or a char.']);
-end
+ assert(isa(varargin{1}, 'report'),['With one arg to Report constructor, ' ...
+ 'you must pass a report object']);
+ r = varargin{1};
+ return;
+elseif nargin > 1
+ if round(nargin/2) ~= nargin/2
+ error(['Options to Report constructor must be supplied in name/value ' ...
+ 'pairs.']);
+ end
-if nargin > 1
- assert(~isa(varargin{1}, 'report'), ...
- ['With multiple args to report constructor, first argument ' ...
- 'cannot be a report object.']);
- for i=1:nargin
- assert(ischar(varargin{i}), ...
- ['With muliple args to report constructor, all '...
- 'arguments must be char.']);
+ optNames = lower(fieldnames(o));
+
+ % overwrite default values
+ for pair = reshape(varargin, 2, [])
+ field = lower(pair{1});
+ if any(strmatch(field, optNames, 'exact'))
+ if strcmp(field, 'orientation')
+ validateOrientation(pair{2});
+ elseif strcmp(field, 'paper')
+ validatePaper(pair{2});
+ end
+ o.(field) = pair{2};
+ else
+ error('%s is not a recognized option to the Report constructor.', ...
+ field);
+ end
end
end
-% Initialize fields
-switch nargin
- case 0
- case 1
- if isa(varargin{1}, 'report')
- r = varargin{1};
- return
- else
- r.title = varargin{1};
- end
- case 2
- r.title = varargin{1};
- r.orientation = validateOrientation(varargin{2});
- case 3
- r.title = varargin{1};
- r.orientation = validateOrientation(varargin{2});
- r.config = varargin{3};
- otherwise
- error('Report constructor: invalid number of arguments');
-end
-
% Create report object
-r = class(r, 'report');
+o = class(o, 'report');
end
\ No newline at end of file
diff --git a/matlab/reports/@report/subsref.m b/matlab/reports/@report/subsref.m
index 9559393fe..25a3001a3 100644
--- a/matlab/reports/@report/subsref.m
+++ b/matlab/reports/@report/subsref.m
@@ -23,6 +23,13 @@ switch S(1).type
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
+ case {'write'}
+ if areParensNext(S)
+ write(A, S(2).subs{:})
+ S = shiftS(S);
+ else
+ write(A);
+ end
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
diff --git a/matlab/reports/@report/write.m b/matlab/reports/@report/write.m
new file mode 100644
index 000000000..124edb96c
--- /dev/null
+++ b/matlab/reports/@report/write.m
@@ -0,0 +1,56 @@
+function write(o)
+%function write(o)
+% Write Report object
+%
+% INPUTS
+% none
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+[fid, msg] = fopen(o.filename, 'w');
+if fid == -1
+ error(msg);
+end
+
+fprintf(fid, '%% Report Object\n');
+fprintf(fid, '\\documentclass[11pt]{article}\n');
+
+fprintf(fid, '\\usepackage[%spaper,margin=2.5cm', o.paper);
+if strcmpi(o.orientation, 'landscape')
+ fprintf(fid, ',landscape');
+end
+fprintf(fid, ']{geometry}\n');
+fprintf(fid, '\\usepackage{graphicx}\n');
+fprintf(fid, '\\usepackage{pdflscape}\n')
+fprintf(fid, '\\begin{document}\n');
+
+o.pages.write(fid, addIndentation(''));
+
+fprintf(fid, '\\end{document}\n');
+fprintf(fid, '%% End Report Object\n');
+status = fclose(fid);
+if status == -1
+ error('Error closing %s\n', o.filename);
+end
+end
\ No newline at end of file
diff --git a/matlab/reports/@section/addGraph.m b/matlab/reports/@section/addGraph.m
new file mode 100644
index 000000000..dd41fa438
--- /dev/null
+++ b/matlab/reports/@section/addGraph.m
@@ -0,0 +1,39 @@
+function o = addGraph(o, varargin)
+%function o = addGraph(o, varargin)
+% Add a graph to the Cell Array of graphs in the report
+%
+% INPUTS
+% 1 args => add empty graph
+% 2 args => add given graph
+% 3 args => add graph at index
+%
+% OUTPUTS
+% updated section object
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(isa(o, 'section'), 'First argument must be a section object');
+if nargin == 1
+ o.elements = o.elements.addGraph();
+elseif nargin == 2 || nargin == 3
+ o.elements = o.elements.addGraph(varargin{:});
+end
+end
diff --git a/matlab/reports/@section/addTable.m b/matlab/reports/@section/addTable.m
new file mode 100644
index 000000000..d96018289
--- /dev/null
+++ b/matlab/reports/@section/addTable.m
@@ -0,0 +1,39 @@
+function o = addTable(o, varargin)
+%function o = addTable(o, varargin)
+% Add a table to the Cell Array of tables in the report
+%
+% INPUTS
+% 1 args => add empty table
+% 2 args => add given table
+% 3 args => add table at index
+%
+% OUTPUTS
+% updated section object
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(isa(o, 'section'), 'First argument must be a section object');
+if nargin == 1
+ o.elements = o.elements.addTable();
+elseif nargin == 2 || nargin == 3
+ o.elements = o.elements.addTable(varargin{:});
+end
+end
diff --git a/matlab/reports/@section/display.m b/matlab/reports/@section/display.m
index e34ede934..4ca24a018 100644
--- a/matlab/reports/@section/display.m
+++ b/matlab/reports/@section/display.m
@@ -30,5 +30,13 @@ function display(o)
name = 'report.page.section';
disp(' ');
-disp([name '.x = ']);
+disp([name '.align = ']);
+disp(' ');
+disp([' ''' o.align '''']);
+
+disp(' ');
+disp([name '.elements = ']);
+disp(' ');
+disp(o.elements.getElements());
+
end
\ No newline at end of file
diff --git a/matlab/reports/@section/numElements.m b/matlab/reports/@section/numElements.m
new file mode 100644
index 000000000..c1c54b952
--- /dev/null
+++ b/matlab/reports/@section/numElements.m
@@ -0,0 +1,22 @@
+function n = numElements(o)
+% function n = numElements(o)
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+n = o.elements.numElements();
+end
\ No newline at end of file
diff --git a/matlab/reports/@section/section.m b/matlab/reports/@section/section.m
index bffe13307..94d1fc0ad 100644
--- a/matlab/reports/@section/section.m
+++ b/matlab/reports/@section/section.m
@@ -1,5 +1,7 @@
-function s = section(varargin)
-%function s = section(varargin)
+function o = section(varargin)
+%function o = section(varargin)
+
+% Section produces a latex minipage
% Copyright (C) 2013 Dynare Team
%
@@ -18,15 +20,39 @@ function s = section(varargin)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-switch nargin
- case 0
- s = class(struct, 'section', objArray());
- case 1
- assert(isa(varargin{1}, 'section'), ['Section constructor: the only ' ...
- 'valid arguments are section objects']);
- s = varargin{1};
- otherwise
- error('Section constructor: invalid number of arguments');
-end
+o = struct;
+o.align = 't';
+o.elements = elements();
+o.rows = 1;
+o.cols = 1;
+
+
+if nargin == 1
+ assert(isa(varargin{1}, 'section'),['With one arg to Section constructor, ' ...
+ 'you must pass a section object']);
+ o = varargin{1};
+ return;
+elseif nargin > 1
+ if round(nargin/2) ~= nargin/2
+ error(['Options to Section constructor must be supplied in name/' ...
+ 'value pairs.']);
+ end
+
+ optNames = lower(fieldnames(o));
+
+ % overwrite default values
+ for pair = reshape(varargin, 2, [])
+ field = lower(pair{1});
+ if any(strmatch(field, optNames, 'exact'))
+ o.(field) = pair{2};
+ else
+ error('%s is not a recognized option to the Section constructor.', ...
+ field);
+ end
+ end
+end
+
+% Create section object
+o = class(o, 'section');
end
diff --git a/matlab/reports/@section/subsref.m b/matlab/reports/@section/subsref.m
index 56773a65e..cf3c18010 100644
--- a/matlab/reports/@section/subsref.m
+++ b/matlab/reports/@section/subsref.m
@@ -23,6 +23,13 @@ switch S(1).type
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
+ case {'write'}
+ if areParensNext(S)
+ write(A, S(2).subs{:})
+ S = shiftS(S);
+ else
+ assert(false);
+ end
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
@@ -34,7 +41,7 @@ switch S(1).type
error(['Section Class: unknown field or method: ' S(1).subs]);
end
case '()'
- A = getSections(A, S(1).subs{:});
+ A = getElements(A, S(1).subs{:});
case '{}'
error(['Section Class: ' S(1).type ' indexing not supported.']);
otherwise
diff --git a/matlab/reports/@section/write.m b/matlab/reports/@section/write.m
new file mode 100644
index 000000000..aa81110ab
--- /dev/null
+++ b/matlab/reports/@section/write.m
@@ -0,0 +1,44 @@
+function write(o, fid, indent)
+%function write(o, fid, indent)
+% Write Section object
+%
+% INPUTS
+% fid - int, file id
+% indent - char, number of spaces to indent tex code
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(fid ~= -1);
+
+fprintf(fid, '\n%s%% Section Object\n', indent);
+fprintf(fid, '%s\\noindent\\begin{minipage}[%s]{0.32\\hsize}\n', indent, o.align);
+
+ne = numElements(o);
+for i=1:ne
+ o.elements(i).write(fid, addIndentation(indent));
+end
+
+fprintf(fid, '%s\\end{minipage}\n', indent);
+fprintf(fid, '%s%% End Section Object\n\n', indent);
+end
\ No newline at end of file
diff --git a/matlab/reports/@sections/subsasgn.m b/matlab/reports/@sections/subsasgn.m
index 3311423ee..1916c1a5c 100644
--- a/matlab/reports/@sections/subsasgn.m
+++ b/matlab/reports/@sections/subsasgn.m
@@ -32,7 +32,7 @@ switch S.type
case '()'
index = S.subs{:};
assert(isnumeric(index));
- B(index) = V;
+ B.objArray(index) = V;
otherwise
error('objArray subsasign syntax error')
end
diff --git a/matlab/reports/@sections/subsref.m b/matlab/reports/@sections/subsref.m
index 89e2948f8..d777cd020 100644
--- a/matlab/reports/@sections/subsref.m
+++ b/matlab/reports/@sections/subsref.m
@@ -23,6 +23,13 @@ switch S(1).type
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
+ case {'write'}
+ if areParensNext(S)
+ write(A, S(2).subs{:})
+ S = shiftS(S);
+ else
+ assert(false);
+ end
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
diff --git a/matlab/reports/@sections/write.m b/matlab/reports/@sections/write.m
new file mode 100644
index 000000000..3370edd68
--- /dev/null
+++ b/matlab/reports/@sections/write.m
@@ -0,0 +1,39 @@
+function write(o, fid, indent)
+%function write(o, fid, indent)
+% Write Sections object
+%
+% INPUTS
+% fid - int, file id
+% indent - char, number of spaces to indent tex code
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(fid ~= -1);
+fprintf(fid, '\n%s%% Sections Object\n', indent);
+nps = numSections(o);
+for i=1:nps
+ o.objArray(i).write(fid, indent);
+end
+fprintf(fid, '%s%% End Sections Object\n\n', indent);
+end
\ No newline at end of file
diff --git a/matlab/reports/@table/display.m b/matlab/reports/@table/display.m
new file mode 100644
index 000000000..1e633e311
--- /dev/null
+++ b/matlab/reports/@table/display.m
@@ -0,0 +1,57 @@
+function display(o)
+%function display(o)
+% Display a Table object
+%
+% INPUTS
+% none
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+name = 'report.page.section.table';
+disp(' ');
+disp([name '.caption = ']);
+disp(' ');
+disp([' ''' o.caption '''']);
+
+disp(' ');
+disp([name '.footnote = ']);
+disp(' ');
+disp([' ''' o.footnote '''']);
+
+disp(' ');
+disp([name '.hlines = ']);
+disp(' ');
+disp([' ''' o.hlines '''']);
+
+disp(' ');
+disp([name '.vlines = ']);
+disp(' ');
+disp([' ''' o.vlines '''']);
+
+disp(' ');
+disp([name '.data = ']);
+disp(' ');
+disp([' ''' o.data '''']);
+
+end
\ No newline at end of file
diff --git a/matlab/reports/@table/subsasgn.m b/matlab/reports/@table/subsasgn.m
new file mode 100644
index 000000000..deef33b82
--- /dev/null
+++ b/matlab/reports/@table/subsasgn.m
@@ -0,0 +1,42 @@
+function B = subsasgn(A, S, V)
+% function B = subsasgn(A, S, V)
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+B = A;
+if length(S) > 1
+ for i=1:(length(S)-1)
+ B = subsref(B, S(i));
+ end
+ B = subsasgn(B, S(end), V);
+ B = subsasgn(A, S(1:(end-1)), B);
+ return
+end
+
+switch S.type
+ case '.'
+ switch S.subs
+ case fieldnames(A)
+ B.(S.subs) = V;
+ otherwise
+ error(['field ' S.subs 'does not exist in the page class'])
+ end
+ otherwise
+ error('report subsasign syntax error')
+end
+end
\ No newline at end of file
diff --git a/matlab/reports/@table/subsref.m b/matlab/reports/@table/subsref.m
new file mode 100644
index 000000000..1f9468eda
--- /dev/null
+++ b/matlab/reports/@table/subsref.m
@@ -0,0 +1,46 @@
+function A = subsref(A, S)
+%function A = subsref(A, S)
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+switch S(1).type
+ case '.'
+ switch S(1).subs
+ case fieldnames(A)
+ A = A.(S(1).subs);
+ case methods(A)
+ if areParensNext(S)
+ A = feval(S(1).subs, A, S(2).subs{:});
+ S = shiftS(S);
+ else
+ A = feval(S(1).subs, A);
+ end
+ otherwise
+ error(['Table Class: unknown field or method: ' S(1).subs]);
+ end
+ case {'()', '{}'}
+ error(['Table Class: ' S(1).type ' indexing not supported.']);
+ otherwise
+ error('Table Class: subsref.m impossible case')
+end
+
+S = shiftS(S);
+if length(S) >= 1
+ A = subsref(A, S);
+end
+end
diff --git a/matlab/reports/@table/table.m b/matlab/reports/@table/table.m
new file mode 100644
index 000000000..bf12a8b67
--- /dev/null
+++ b/matlab/reports/@table/table.m
@@ -0,0 +1,66 @@
+function o = table(varargin)
+%function o = table(varargin)
+% Table Class Constructor
+%
+% INPUTS
+% 0 args => empty table
+% 1 arg (table class) => copy object
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+o = struct;
+o.caption = '';
+o.footnote = '';
+o.hlines = false;
+o.vlines = false;
+o.data = '';
+
+if nargin == 1
+ assert(isa(varargin{1}, 'table'),['With one arg to Table constructor, ' ...
+ 'you must pass a table object']);
+ o = varargin{1};
+ return;
+elseif nargin > 1
+ if round(nargin/2) ~= nargin/2
+ error(['Options to Table constructor must be supplied in name/value ' ...
+ 'pairs.']);
+ end
+
+ optNames = lower(fieldnames(o));
+
+ % overwrite default values
+ for pair = reshape(varargin, 2, [])
+ field = lower(pair{1});
+ if any(strmatch(field, optNames, 'exact'))
+ o.(field) = pair{2};
+ else
+ error('%s is not a recognized option to the Table constructor.', ...
+ field);
+ end
+ end
+end
+
+% Create table object
+o = class(o, 'table');
+end
\ No newline at end of file
diff --git a/matlab/reports/@table/write.m b/matlab/reports/@table/write.m
new file mode 100644
index 000000000..4ad52ff8c
--- /dev/null
+++ b/matlab/reports/@table/write.m
@@ -0,0 +1,40 @@
+function write(o, fid, texIndent)
+%function write(o, fid)
+% Write a Page object
+%
+% INPUTS
+% none
+%
+% OUTPUTS
+% none
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+assert(fid > 0);
+assert(isnumeric(texIndent));
+
+fprintf(fid, '%d\% Page Object\n', texIndent);
+fprintf(fid, '%d\newpage\n', texIndent);
+
+o.sections.write(fid, texIndent+2);
+
+fprintf(fid, '%d\% End Page Object\n', texIndent);
+end
\ No newline at end of file
diff --git a/matlab/reports/addIndentation.m b/matlab/reports/addIndentation.m
new file mode 100644
index 000000000..4bbea49b7
--- /dev/null
+++ b/matlab/reports/addIndentation.m
@@ -0,0 +1,31 @@
+function spaces=addIndentation(spaces)
+% Return new level of indentation for latex output
+%
+% INPUTS
+% spaces - char, current level of indentation
+%
+% OUTPUTS
+% spaces - char, new level of indentation
+%
+% SPECIAL REQUIREMENTS
+% none
+
+% Copyright (C) 2013 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare 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.
+%
+% Dynare 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 Dynare. If not, see .
+
+spaces = [spaces ' '];
+end
\ No newline at end of file