thliebig / openEMS

openEMS is a free and open-source electromagnetic field solver using the EC-FDTD method.
http://openEMS.de
GNU General Public License v3.0
459 stars 156 forks source link

The isOctave() function isn't available in Octave #124

Open yurivict opened 1 year ago

yurivict commented 1 year ago

openEMS uses isOctave here but octave-8.3.0 doesn't provide it.

info/octave.info-9 provides an example implementation of such function:

   Example: 

     %%
     %% Return: true if the environment is Octave.
     %%
     function retval = isOctave
       persistent cacheval;  % speeds up repeated calls

       if isempty (cacheval)
         cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
       end

       retval = cacheval;
     end

You also define this function in matlab/WriteHDF5.m:

isOctave = exist('OCTAVE_VERSION','builtin') ~= 0;

thliebig commented 1 year ago

well this variable "isOctave" was meant to already be available from the context where the test-suite is started. But this is all very very old code and I'm not sure if it is still in any use. Otherwise feel free to define it properly. But I don't think that we need anything fancy as the example above as this is nothing that gets called more than once or a few times... A one-liner would be still sufficient I think