This file is indexed.

/usr/share/octave/packages/financial-0.4.0/dateaxis.m is in octave-financial 0.4.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
## Copyright (C) 2008 Bill Denney <bill@denney.ws>
##
## This program 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.
##
## This program 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
## this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn {Function File} {} dateaxis ()
## @deftypefnx {Function File} {} dateaxis (@var{ax})
## @deftypefnx {Function File} {} dateaxis (@var{ax}, @var{dateform})
## @deftypefnx {Function File} {} dateaxis (@var{ax}, @var{dateform}, @var{startdate})
## @deftypefnx {Function File} {} dateaxis (@var{h}, ...)
##
## Convert the current axis tick labels (or the axis handle @var{h}) to
## a date format.  The axis given by @var{ax} ("x", "y", or "z") will be
## changed; the default is "x".  The date format, @var{dateform}, used
## will be either auto-determined or an integer corresponding to the
## date formats in datestr. If @var{startdate} is given, then the first
## tick value on the given axis is assumed to be that date.
##
## @seealso{bolling, candle, highlow, movavg, pointfig}
## @end deftypefn

function dateaxis (varargin)

  ## defaults
  h         = [];
  ax        = "x";
  dateform  = [];
  startdate = [];

  ## check inputs
  if nargin > 0
    if ishandle(varargin{1})
      h = varargin{1};
      varargin(1) = [];
    endif
    if length(varargin) > 0
      ax = varargin{1};
    endif
    if length(varargin) > 1
      dateform = varargin{2};
    endif
    if length(varargin) > 2
      startdate = varargin{3};
      if ischar(startdate)
        startdate = datenum(startdate);
      elseif !isnumeric(startdate)
        error ("dateaxis: startdate must be either a datenum or numeric")
      endif
    endif
    if length(varargin) > 3
      print_usage ();
    endif
  endif
  
  if (isempty (h))
    h = gca ();
  endif

  if isempty(dateform)
    r = range(get(h, [ax "lim"]));
    if r < 10/60/24
      ## minutes and seconds
      dateform = 13;
    elseif r < 2
      ## hours
      dateform = 15;
    elseif r < 15
      ## days
      dateform = 8;
    elseif r < 365
      ## months
      dateform = 6;
    elseif r < 90*12
      ## quarters
      dateform = 27;
    else
      ## years
      dateform = 10;
    endif
  endif

  ticks = get (h, [ax "tick"]);
  if (!isempty (startdate))
    ticks = ticks - ticks(1) + startdate;
  endif
  ticks = datestr(ticks, dateform);
  ticks = mat2cell(ticks, ones(size(ticks,1),1), size(ticks,2));
  set (h, [ax "ticklabel"], ticks);

endfunction