Skip to content

Commit

Permalink
Intermediate: some more testing with GNU Octave
Browse files Browse the repository at this point in the history
Tweaked a little the +colorlab procedures to help with Octave compatibility,
but unfortunately the palette functions appear to be doomed. Too much problems,
Octave does not even access the private folders inside packages, does have very
different structure for the groot and other graphics-related objects. I think
we can say that no, it would never be fully supported. Let's be happy that at
least the +rgb routines do work... :)
  • Loading branch information
beddalumia committed Jun 1, 2022
1 parent 50be7a1 commit efe1f2f
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 8 deletions.
30 changes: 27 additions & 3 deletions +colorlab/enter.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ function enter(quiet)
folder = erase(fileparts(mfilename('fullpath')),'+colorlab');
% > COLORLAB initiates itself

COLORLAB = xgenpath(folder,'**/*.git');
try
COLORLAB = xgenpath(folder,'**/*.git');
catch
COLORLAB = genpath(folder);
end
oldpath = addpath(COLORLAB);
printflag = not(isequal(oldpath,path));

% Better to check for duplicates
find_duplicate(folder);
% Better to check for duplicates (in MATLAB)
if ~isoctave
find_duplicate(folder);
end

% Let the user decide if to save or not to save...
if printflag && not(quietflag)
Expand All @@ -40,4 +46,22 @@ function enter(quiet)
fprintf(' \n \n')
end

end

% contains

function bool = isoctave()
%% ISOCTAVE Determines if you are running under GNU Octave or MATLAB
%
% >> isoctave()
%
% ans =
%
% logical
%
% 0 ----> IF running under MATLAB
% 1 ----> IF running under OCTAVE
%
% See also ispc, ismac, isunix, ver
bool = exist('__octave_config_info__','builtin') == 5;
end
28 changes: 26 additions & 2 deletions +colorlab/leave.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ function leave(quiet)
folder = erase(fileparts(mfilename('fullpath')),'+colorlab');
% > COLORLAB destroys itself

COLORLAB = xgenpath(folder,'**/*.git');
try
COLORLAB = xgenpath(folder,'**/*.git');
catch
COLORLAB = genpath(folder);
end
oldpath = rmpath(COLORLAB);
addpath(userpath); % Safety-measure
if ~isoctave
addpath(userpath); % Safety-measure
end
printflag = not(isequal(oldpath,path));

% Final greetings!
Expand All @@ -38,3 +44,21 @@ function leave(quiet)
fprintf(' \n \n')
end
end

% contains

function bool = isoctave()
%% ISOCTAVE Determines if you are running under GNU Octave or MATLAB
%
% >> isoctave()
%
% ans =
%
% logical
%
% 0 ----> IF running under MATLAB
% 1 ----> IF running under OCTAVE
%
% See also ispc, ismac, isunix, ver
bool = exist('__octave_config_info__','builtin') == 5;
end
29 changes: 26 additions & 3 deletions +colorlab/vista.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@

function vista()

folder = erase(fileparts(mfilename('fullpath')),'+colorlab');
% > COLORLAB introspects itself
folder = erase(fileparts(mfilename('fullpath')),'+colorlab');
% > COLORLAB introspects itself

xpathshow(folder);
if isoctave
p = genpath(folder);
disp(strsplit(p,pathsep));
else
xpathshow(folder); % Finer MATLAB option
end

% Would the user decide to enter... promote it!
fprintf('\n')
Expand All @@ -20,4 +25,22 @@ function vista()
fprintf(' > If you are thrilled: colorlab.enter() ✧ \n')
fprintf('\n')

end

% contains

function bool = isoctave()
%% ISOCTAVE Determines if you are running under GNU Octave or MATLAB
%
% >> isoctave()
%
% ans =
%
% logical
%
% 0 ----> IF running under MATLAB
% 1 ----> IF running under OCTAVE
%
% See also ispc, ismac, isunix, ver
bool = exist('__octave_config_info__','builtin') == 5;
end

0 comments on commit efe1f2f

Please sign in to comment.