File: toggle_plplot_use.m

package info (click to toggle)
plplot 5.9.0-8
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 26,256 kB
  • ctags: 9,353
  • sloc: ansic: 64,079; xml: 22,799; cpp: 8,562; tcl: 8,314; perl: 4,872; python: 4,462; f90: 4,310; java: 4,090; sh: 1,481; makefile: 261; php: 102; fortran: 59; sed: 5
file content (86 lines) | stat: -rw-r--r-- 2,787 bytes parent folder | download
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
## usage: toggle_plplot_use
##
## Use this script to activate/deactivate the default library for the
## PLplot plotting function (plot, mesh, etc.), as both the native
## gnuplot and the new octave-plplot libraries use similar names to the
## functions. toggle_plplot_use post-/pre-pends to LOADPATH the path for
## the PLplot functions in successive calls.

## File: toggle_plplot_use.m
## Author: Rafael Laboissiere <rafael@debian.org>
## Modified: Joao Cardoso
## Created on: Sun Oct 18 22:03:10 CEST 1998
## Last modified on: Fri Mar  7 09:38:38 CET 2003
##
## Copyright (C) 2003  Rafael Laboissiere
##
## PLplot is free software, distributable under the GPL. No
## warranties, use it at your own risk.  It  was originally written for
## inclusion in the Debian octave-plplot package.

1;

if ! exist ("use_plplot_state")
  global use_plplot_state
  use_plplot_state = "on";
  # Warn user about spurious warnings with octave 2.9
  ver = str2num(split(version,"."));
  if ((ver(1) == 2 && ver(2) == 9) || (ver(1) >= 3)) 
    if (warning("query","Octave:built-in-variable-assignment").state == "on")
      warning("You may want to call\n  warning(\"off\",\"Octave:built-in-variable-assignment\");\nto prevent spurious warnings from the plplot code for compatability with octave 2.0/2.1.\n");
    endif
  endif
else
  if strcmp (use_plplot_state, "on")
    use_plplot_state = "off";
  else
    use_plplot_state = "on";
  endif
endif

use_plplot_path = plplot_octave_path;
# Strip of trailing // for octave >= 2.9
if (!exist("LOADPATH"))
  use_plplot_path = use_plplot_path(1:end-2);
endif
if (exist("LOADPATH"))
  use_plplot_i = findstr (LOADPATH, use_plplot_path);
  if (!isempty (use_plplot_i))
    LOADPATH (use_plplot_i(1):use_plplot_i(1)+length(use_plplot_path)-1)= "";
    LOADPATH = strrep (LOADPATH, "::", ":");
  endif
else
  plplot_path_to_remove = split(genpath(use_plplot_path),pathsep);
  for i=1:size(plplot_path_to_remove)(1)
    if (findstr(path,deblank(plplot_path_to_remove(i,:))) > 0)
      rmpath(deblank(plplot_path_to_remove(i,:)));
    endif
  endfor
endif

if (strcmp (use_plplot_state, "on"))
  if (exist("LOADPATH"))
    LOADPATH = [use_plplot_path, ":", LOADPATH];
  else
    addpath(genpath(use_plplot_path));
  endif
  plplot_stub;
elseif (strcmp (use_plplot_state, "off"))
  if (exist("LOADPATH"))
    LOADPATH = [LOADPATH, ":", use_plplot_path];
  else
    addpath(genpath(use_plplot_path),"-end");
  endif
endif

use_plplot_lcd = pwd;
cd (use_plplot_path);
for  use_plplot_i = [ char(glob("*.m ")); char(glob("support/*.m ")) ]'
  clear (strrep (strrep (deblank(use_plplot_i'), ".m", ""), "support/", ""));
end
cd (use_plplot_lcd);

clear use_plplot_path use_plplot_lcd use_plplot_i plplot_path_to_remove

printf ("Use PLplot: %s\n", use_plplot_state);