## Copyright (C) 2007 Lei Jia ## ## This file is part of Octave. ## ## Octave 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 2, or (at your option) ## any later version. ## ## Octave 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 Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} getval (@var{opt}) ## This function interprets strings into parameters. ## The return value serves other functions. ## ## @var{opt} is a string of a number. ## There is an aiternative and intuitive representation to specify the parameters. ## @example ## line type only visible under postscript terminal: ## Number Symbol Line Type ## -1 wd wide solid ## 0 ds separated dash ## 1 nm normal ## 2 dt dotted ## 3 ld little dotted ## 4 md many dotted ## 5 dd dash and dotted ## 6 sd separated dash and dotted ## 7 pd pair dotted ## 8 mp pair dash and dotted ## 9 gp group dotted ## @end example ## ## @example ## line color under aqua terminal: ## Number Symbol Line Color ## -2 lg light grey ## -1 bk black ## 0 gy grey ## 1 rd red ## 2 gr green ## 3 bl blue ## 4 pk pink ## 5 sk sky ## 6 br brown ## 7 or orange ## 8 fr forest ## 9 lb light black ## @end example ## ## @example ## point type under aqua ternimal: ## Number Symbol Point Style ## 1 + plus sign ## 2 x multiplication sign ## 3 * star sign ## 4 sq square ## 5 rh rhombus ## 6 tr triangle ## @end example ## ## This function is not intended for the user. ## it is only used by other related functions. ## @seealso{eplot, emesh, econtour, gcontour, __eplt__, __epltopt__, __pltopt2__} ## @end deftypefn ## Author: Lei Jia function [val, opt] = getval (opt) val = ""; tmp = ""; len = length(opt); while (len > 0) tmp = opt(1); if (strcmp(tmp, "|")) break; elseif (strcmp(tmp, ")")) opt = opt(2:len); len--; break; else val = strcat(val, tmp); opt = opt(2:len); len--; endif endwhile if (strcmp(val, "")) val = "1"; endif ## interpret line type if (strcmp(val, "wd")) val = "-1"; elseif (strcmp(val, "ds")) val = "0"; elseif (strcmp(val, "nm")) val = "1"; elseif (strcmp(val, "dt")) val = "2"; elseif (strcmp(val, "ld")) val = "3"; elseif (strcmp(val, "md")) val = "4"; elseif (strcmp(val, "dd")) val = "5"; elseif (strcmp(val, "sd")) val = "6"; elseif (strcmp(val, "pd")) val = "7"; elseif (strcmp(val, "mp")) val = "8"; elseif (strcmp(val, "gp")) val = "9"; endif ## interpret line color if (strcmp(val, "lg")) val = "-2"; elseif (strcmp(val, "bk")) val = "-1"; elseif (strcmp(val, "gy")) val = "0"; elseif (strcmp(val, "rd")) val = "1"; elseif (strcmp(val, "gr")) val = "2"; elseif (strcmp(val, "bl")) val = "3"; elseif (strcmp(val, "pk")) val = "4"; elseif (strcmp(val, "sk")) val = "5"; elseif (strcmp(val, "br")) val = "6"; elseif (strcmp(val, "or")) val = "7"; elseif (strcmp(val, "fr")) val = "8"; elseif (strcmp(val, "lb")) val = "9"; endif ## interpret point type if (strcmp(val, "+")) val = "1"; elseif (strcmp(val, "x")) val = "2"; elseif (strcmp(val, "*")) val = "3"; elseif (strcmp(val, "sq")) val = "4"; elseif (strcmp(val, "rh")) val = "5"; elseif (strcmp(val, "tr")) val = "6"; endif ## different terminals have different lt, lw, lc, pt, and ps ## lt is based on postscript color, lc and pt are based on aqua endfunction