From 4ee7d12cdab5cc4b0c050eaa95e21d1f0251f8d7 Mon Sep 17 00:00:00 2001 From: vdhoeven Date: Wed, 25 Aug 2010 16:32:25 +0000 Subject: [PATCH] Fixes for new version of Octave git-svn-id: svn://svn.savannah.gnu.org/texmacs/trunk@3055 64cb5145-927a-446d-8aed-2fb7b4773692 --- src/plugins/octave/octave/.octaverc | 52 +++++++++++++++++++++++++++------- src/plugins/octave/octave/tm-start.oct | 15 +++------- src/plugins/octave/octave/tm/tmrepl.m | 2 +- 3 files changed, 46 insertions(+), 23 deletions(-) rewrite src/plugins/octave/octave/.octaverc (68%) rewrite src/plugins/octave/octave/tm-start.oct (89%) diff --git a/src/plugins/octave/octave/.octaverc b/src/plugins/octave/octave/.octaverc dissimilarity index 68% index 1b21bfbe..e5355064 100644 --- a/src/plugins/octave/octave/.octaverc +++ b/src/plugins/octave/octave/.octaverc @@ -1,11 +1,41 @@ -d=getenv("TEXMACS_PATH"); -if (length(d) > 0) - LOADPATH=[[d,"/plugins/octave/octave/tm:"],[d,"/plugins/octave/octave/plot:"],[d,"/plugins/octave/octave/polynomial:"],LOADPATH]; - PS1="\\002channel:prompt\\005octave> \\005"; - PS2="\\002channel:prompt\\005> \\005"; - global TMSTRUCT=0; - global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green"; "blue";]; global TMCOLIDX=6; - gset terminal postscript eps enhanced color; - gset size 0.5,0.5; -endif - +d=getenv("TEXMACS_PATH"); +if (length(d) > 0) + # Add the following directories to Octave's ``load path'': + # - ${TEXMACS_PATH}/plugins/octave/octave/tm + # - ${TEXMACS_PATH}/plugins/octave/octave/plot + # - ${TEXMACS_PATH}/plugins/octave/octave/polynomial + if (exist ("OCTAVE_VERSION") == 5) + # As of Octave version 3, "instead of setting the built-in variable + # LOADPATH, you must use addpath [...] to manipulate the function + # search path." [1] + fsep=filesep(); + prefix=[d,fsep,"plugins",fsep,"octave",fsep,"octave",fsep]; + addpath ([prefix,"tm"], "-end"); + addpath ([prefix,"plot"], "-end"); + addpath ([prefix,"polynomial"], "-end"); + # NB: filesep() is used above for portability. + else + LOADPATH=[LOADPATH, \ + [d,"/plugins/octave/octave/tm:"], \ + [d,"/plugins/octave/octave/plot:"], \ + [d,"/plugins/octave/octave/polynomial:"]]; + endif + + # Customize the command-line prompt. + if (exist ("OCTAVE_VERSION") == 5) + # As of Octave version 3, "all built-in variables have been converted + # to functions." [1] + PS1("\\002channel:prompt\\005octave> \\005"); + PS2("\\002channel:prompt\\005> \\005"); + else + PS1="\\002channel:prompt\\005octave> \\005"; + PS2="\\002channel:prompt\\005> \\005"; + endif + + # Define some global variables. + global TMSTRUCT=0; + global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green"; "blue";]; + global TMCOLIDX=rows(TMCOLORS); +endif + +# [1] diff --git a/src/plugins/octave/octave/tm-start.oct b/src/plugins/octave/octave/tm-start.oct dissimilarity index 89% index 75a33ffd..6d1f5c98 100644 --- a/src/plugins/octave/octave/tm-start.oct +++ b/src/plugins/octave/octave/tm-start.oct @@ -1,11 +1,4 @@ -d=getenv("TEXMACS_PATH"); -if (length(d) > 0) - LOADPATH=[[d,"/plugins/octave/octave/tm:"],[d,"/plugins/octave/octave/plot:"],[d,"/plugins/octave/octave/polynomial:"],LOADPATH]; - PS1="\\002channel:prompt\\005octave> \\005"; - PS2="\\002channel:prompt\\005> \\005"; - global TMSTRUCT=0; - global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green"; "blue";]; global TMCOLIDX=6; - gset terminal postscript eps enhanced color; - gset size 0.5,0.5; - tmrepl -endif +d=getenv("TEXMACS_PATH"); +if (length(d) > 0) + tmrepl +endif diff --git a/src/plugins/octave/octave/tm/tmrepl.m b/src/plugins/octave/octave/tm/tmrepl.m index 28d2e981..e1e78fbd 100644 --- a/src/plugins/octave/octave/tm/tmrepl.m +++ b/src/plugins/octave/octave/tm/tmrepl.m @@ -11,7 +11,7 @@ function tmrepl() r=sprintf("%ctexmacs%c; %s;",39,39,r); eval(r,"tmlasterr"); if dispans & isnewans(ans) - tmdisp(ans); + tmdisp(ans); endif r=input(prompt,'s'); endwhile -- 2.11.4.GIT