octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

isunix, ispc


From: John W. Eaton
Subject: isunix, ispc
Date: Fri, 9 Jan 2004 20:12:33 -0600

Matlab has the functions

  isunix: return true if running on a "unix" system, false otherwise
  ispc:   return true if running on a Windows system, false otherwise

I see that octave-forge has two versions of isunix.m, one that should
be installed on Unix-like systems and one that should be installed on
Windows systems.  Instead of having two files, I propose that we have
just one, and that it gets the return value from octave_config_info.

Likewise, computer could be converted from a built-in function to an
M-file and get the system information from octave_config_info.

We currently have canonical_host_type in the struct returned by
octave_config_info, so converting computer will be simple.  For the
isunix and ispc info, we will need to add some information.

What about Cygwin?  I think we should have isunix return true for that
system since it looks like a unix system, but we could also have ispc
return true because it also looks like Windows system.

So I propose adding the equivalent of

  bool windows_system = false;
  bool unix_system = true;
  #if defined (WIN32)
    windows = true;
  #if ! defined (__CYGWIN__)
    unix = false;
  #endif
  #endif

  m.assign ("windows", octave_value (windows_system));

  m.assign ("unix", octave_value (unix_system));

to add the fields windows and unix to the structure.  I think this
should also be correct for OS X which looks like a Unix system to
Octave.  We will only need to modify it if Octave is someday ported to
a system other than WIN32 that does not look like Unix.

Comments?

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]