# HG changeset patch # User Andrej Lojdl # Date 1379427978 -7200 # Node ID a46a648a2de21e49cc660f9047eada86e6156d85 # Parent d415dc6ac1e21b301b090b7c9166fe7f061c8f50# Parent 84d195e050fd632fc15bddf2fae08d9855a340ce Merged with main, after horizontal/vertical alignment and rotation added. diff --git a/doc/interpreter/stmt.txi b/doc/interpreter/stmt.txi --- a/doc/interpreter/stmt.txi +++ b/doc/interpreter/stmt.txi @@ -850,13 +850,12 @@ @var{catch} statements are evaluated. @xref{Errors and Warnings}, for more information about the @code{lasterr} function. +@node Continuation Lines +@section Continuation Lines @cindex continuation lines @cindex @code{...} continuation marker @cindex @code{\} continuation marker -@node Continuation Lines -@section Continuation Lines - In the Octave language, most statements end with a newline character and you must tell Octave to ignore the newline character in order to continue a statement from one line to the next. Lines that end with the diff --git a/libgui/src/resource-manager.cc b/libgui/src/resource-manager.cc --- a/libgui/src/resource-manager.cc +++ b/libgui/src/resource-manager.cc @@ -235,1563 +235,3 @@ { return QTerminal::default_colors (); } - -const char* -resource_manager::octave_keywords (void) -{ - return - ".nargin. " - "EDITOR " - "EXEC_PATH " - "F_DUPFD " - "F_GETFD " - "F_GETFL " - "F_SETFD " - "F_SETFL " - "I " - "IMAGE_PATH " - "Inf " - "J " - "NA " - "NaN " - "OCTAVE_HOME " - "OCTAVE_VERSION " - "O_APPEND " - "O_ASYNC " - "O_CREAT " - "O_EXCL " - "O_NONBLOCK " - "O_RDONLY " - "O_RDWR " - "O_SYNC " - "O_TRUNC " - "O_WRONLY " - "PAGER " - "PAGER_FLAGS " - "PS1 " - "PS2 " - "PS4 " - "P_tmpdir " - "SEEK_CUR " - "SEEK_END " - "SEEK_SET " - "SIG " - "S_ISBLK " - "S_ISCHR " - "S_ISDIR " - "S_ISFIFO " - "S_ISLNK " - "S_ISREG " - "S_ISSOCK " - "WCONTINUE " - "WCOREDUMP " - "WEXITSTATUS " - "WIFCONTINUED " - "WIFEXITED " - "WIFSIGNALED " - "WIFSTOPPED " - "WNOHANG " - "WSTOPSIG " - "WTERMSIG " - "WUNTRACED " - "__accumarray_max__ " - "__accumarray_min__ " - "__accumarray_sum__ " - "__accumdim_sum__ " - "__all_opts__ " - "__builtins__ " - "__calc_dimensions__ " - "__contourc__ " - "__current_scope__ " - "__delaunayn__ " - "__dispatch__ " - "__display_tokens__ " - "__dsearchn__ " - "__dump_symtab_info__ " - "__error_text__ " - "__finish__ " - "__fltk_ginput__ " - "__fltk_print__ " - "__fltk_uigetfile__ " - "__ftp__ " - "__ftp_ascii__ " - "__ftp_binary__ " - "__ftp_close__ " - "__ftp_cwd__ " - "__ftp_delete__ " - "__ftp_dir__ " - "__ftp_mget__ " - "__ftp_mkdir__ " - "__ftp_mode__ " - "__ftp_mput__ " - "__ftp_pwd__ " - "__ftp_rename__ " - "__ftp_rmdir__ " - "__get__ " - "__glpk__ " - "__gnuplot_drawnow__ " - "__gnuplot_get_var__ " - "__gnuplot_ginput__ " - "__gnuplot_has_feature__ " - "__gnuplot_open_stream__ " - "__gnuplot_print__ " - "__gnuplot_version__ " - "__go_axes__ " - "__go_axes_init__ " - "__go_close_all__ " - "__go_delete__ " - "__go_draw_axes__ " - "__go_draw_figure__ " - "__go_execute_callback__ " - "__go_figure__ " - "__go_figure_handles__ " - "__go_handles__ " - "__go_hggroup__ " - "__go_image__ " - "__go_line__ " - "__go_patch__ " - "__go_surface__ " - "__go_text__ " - "__go_uimenu__ " - "__gud_mode__ " - "__image_pixel_size__ " - "__init_fltk__ " - "__isa_parent__ " - "__keywords__ " - "__lexer_debug_flag__ " - "__lin_interpn__ " - "__list_functions__ " - "__magick_finfo__ " - "__magick_format_list__ " - "__magick_read__ " - "__magick_write__ " - "__makeinfo__ " - "__marching_cube__ " - "__next_line_color__ " - "__next_line_style__ " - "__operators__ " - "__parent_classes__ " - "__parser_debug_flag__ " - "__pathorig__ " - "__pchip_deriv__ " - "__plt_get_axis_arg__ " - "__print_parse_opts__ " - "__qp__ " - "__request_drawnow__ " - "__sort_rows_idx__ " - "__strip_html_tags__ " - "__token_count__ " - "__unimplemented__ " - "__varval__ " - "__version_info__ " - "__voronoi__ " - "__which__ " - "abs " - "accumarray " - "accumdim " - "acos " - "acosd " - "acosh " - "acot " - "acotd " - "acoth " - "acsc " - "acscd " - "acsch " - "add_input_event_hook " - "addlistener " - "addpath " - "addproperty " - "addtodate " - "airy " - "all " - "allchild " - "allow_noninteger_range_as_index " - "amd " - "ancestor " - "and " - "angle " - "anova " - "ans " - "any " - "arch_fit " - "arch_rnd " - "arch_test " - "area " - "arg " - "argnames " - "argv " - "arma_rnd " - "arrayfun " - "asctime " - "asec " - "asecd " - "asech " - "asin " - "asind " - "asinh " - "assert " - "assignin " - "atan " - "atan2 " - "atand " - "atanh " - "atexit " - "autocor " - "autocov " - "autoload " - "autoreg_matrix " - "autumn " - "available_graphics_toolkits " - "axes " - "axis " - "balance " - "bar " - "barh " - "bartlett " - "bartlett_test " - "base2dec " - "beep " - "beep_on_error " - "bessel " - "besselh " - "besseli " - "besselj " - "besselk " - "bessely " - "beta " - "betacdf " - "betai " - "betainc " - "betainv " - "betaln " - "betapdf " - "betarnd " - "bicgstab " - "bicubic " - "bin2dec " - "bincoeff " - "binocdf " - "binoinv " - "binopdf " - "binornd " - "bitand " - "bitcmp " - "bitget " - "bitmax " - "bitor " - "bitpack " - "bitset " - "bitshift " - "bitunpack " - "bitxor " - "blackman " - "blanks " - "blkdiag " - "blkmm " - "bone " - "box " - "break " - "brighten " - "bsxfun " - "bug_report " - "builtin " - "bunzip2 " - "bzip2 " - "calendar " - "canonicalize_file_name " - "cart2pol " - "cart2sph " - "case " - "cast " - "cat " - "catch " - "cauchy_cdf " - "cauchy_inv " - "cauchy_pdf " - "cauchy_rnd " - "caxis " - "cbrt " - "ccolamd " - "cd " - "ceil " - "cell " - "cell2mat " - "cell2struct " - "celldisp " - "cellfun " - "cellidx " - "cellindexmat " - "cellslices " - "cellstr " - "center " - "cgs " - "char " - "chdir " - "chi2cdf " - "chi2inv " - "chi2pdf " - "chi2rnd " - "chisquare_test_homogeneity " - "chisquare_test_independence " - "chol " - "chol2inv " - "choldelete " - "cholinsert " - "cholinv " - "cholshift " - "cholupdate " - "chop " - "circshift " - "cla " - "clabel " - "class " - "clc " - "clear " - "clf " - "clg " - "clock " - "cloglog " - "close " - "closereq " - "colamd " - "colloc " - "colon " - "colorbar " - "colormap " - "colperm " - "colstyle " - "columns " - "comet " - "comet3 " - "comma " - "command_line_path " - "common_size " - "commutation_matrix " - "compan " - "compare_versions " - "compass " - "complement " - "completion_append_char " - "completion_matches " - "complex " - "computer " - "cond " - "condest " - "confirm_recursive_rmdir " - "conj " - "continue " - "contour " - "contour3 " - "contourc " - "contourf " - "contrast " - "conv " - "conv2 " - "convhull " - "convhulln " - "convn " - "cool " - "copper " - "copyfile " - "cor " - "cor_test " - "corrcoef " - "cos " - "cosd " - "cosh " - "cot " - "cotd " - "coth " - "cov " - "cplxpair " - "cputime " - "cquad " - "crash_dumps_octave_core " - "create_set " - "cross " - "csc " - "cscd " - "csch " - "cstrcat " - "csvread " - "csvwrite " - "csymamd " - "ctime " - "ctranspose " - "cummax " - "cummin " - "cumprod " - "cumsum " - "cumtrapz " - "curl " - "cut " - "cylinder " - "daspect " - "daspk " - "daspk_options " - "dasrt " - "dasrt_options " - "dassl " - "dassl_options " - "date " - "datenum " - "datestr " - "datetick " - "datevec " - "dbclear " - "dbcont " - "dbdown " - "dblquad " - "dbnext " - "dbquit " - "dbstack " - "dbstatus " - "dbstep " - "dbstop " - "dbtype " - "dbup " - "dbwhere " - "deal " - "deblank " - "debug " - "debug_on_error " - "debug_on_interrupt " - "debug_on_warning " - "dec2base " - "dec2bin " - "dec2hex " - "deconv " - "del2 " - "delaunay " - "delaunay3 " - "delaunayn " - "delete " - "dellistener " - "demo " - "det " - "detrend " - "diag " - "diary " - "diff " - "diffpara " - "diffuse " - "dir " - "discrete_cdf " - "discrete_inv " - "discrete_pdf " - "discrete_rnd " - "disp " - "dispatch " - "display " - "divergence " - "dlmread " - "dlmwrite " - "dmperm " - "dmult " - "do " - "do_braindead_shortcircuit_evaluation " - "do_string_escapes " - "doc " - "doc_cache_create " - "doc_cache_file " - "dos " - "dot " - "double " - "drawnow " - "dsearch " - "dsearchn " - "dump_prefs " - "dup2 " - "duplication_matrix " - "durbinlevinson " - "e " - "echo " - "echo_executing_commands " - "edit " - "edit_history " - "eig " - "eigs " - "ellipsoid " - "else " - "elseif " - "empirical_cdf " - "empirical_inv " - "empirical_pdf " - "empirical_rnd " - "end " - "end_try_catch " - "end_unwind_protect " - "endfor " - "endfunction " - "endgrent " - "endif " - "endpwent " - "endswitch " - "endwhile " - "eomday " - "eps " - "eq " - "erf " - "erfc " - "erfcx " - "erfinv " - "errno " - "errno_list " - "error " - "error_text " - "errorbar " - "etime " - "etree " - "etreeplot " - "eval " - "evalin " - "example " - "exec " - "exist " - "exit " - "exp " - "expcdf " - "expinv " - "expm " - "expm1 " - "exppdf " - "exprnd " - "eye " - "ezcontour " - "ezcontourf " - "ezmesh " - "ezmeshc " - "ezplot " - "ezplot3 " - "ezpolar " - "ezsurf " - "ezsurfc " - "f_test_regression " - "factor " - "factorial " - "fail " - "false " - "fcdf " - "fclear " - "fclose " - "fcntl " - "fdisp " - "feather " - "feof " - "ferror " - "feval " - "fflush " - "fft " - "fft2 " - "fftconv " - "fftfilt " - "fftn " - "fftshift " - "fftw " - "fgetl " - "fgets " - "fieldnames " - "figure " - "file_in_loadpath " - "file_in_path " - "fileattrib " - "filemarker " - "fileparts " - "fileread " - "filesep " - "fill " - "filter " - "filter2 " - "find " - "find_dir_in_path " - "findall " - "findobj " - "findstr " - "finite " - "finv " - "fix " - "fixed_point_format " - "flag " - "flipdim " - "fliplr " - "flipud " - "floor " - "fminbnd " - "fminunc " - "fmod " - "fnmatch " - "fopen " - "for " - "fork " - "format " - "formula " - "fpdf " - "fplot " - "fprintf " - "fputs " - "fractdiff " - "fread " - "freport " - "freqz " - "freqz_plot " - "frewind " - "frnd " - "fscanf " - "fseek " - "fskipl " - "fsolve " - "fstat " - "ftell " - "full " - "fullfile " - "func2str " - "function " - "functions " - "fwrite " - "fzero " - "gamcdf " - "gaminv " - "gamma " - "gammai " - "gammainc " - "gammaln " - "gampdf " - "gamrnd " - "gca " - "gcbf " - "gcbo " - "gcd " - "gcf " - "ge " - "genpath " - "genvarname " - "geocdf " - "geoinv " - "geopdf " - "geornd " - "get " - "get_first_help_sentence " - "get_help_text " - "get_help_text_from_file " - "getappdata " - "getegid " - "getenv " - "geteuid " - "getfield " - "getgid " - "getgrent " - "getgrgid " - "getgrnam " - "gethostname " - "getpgrp " - "getpid " - "getppid " - "getpwent " - "getpwnam " - "getpwuid " - "getrusage " - "getuid " - "ginput " - "givens " - "glob " - "global " - "glpk " - "glpkmex " - "gls " - "gmap40 " - "gmres " - "gmtime " - "gnuplot_binary " - "gplot " - "gradient " - "graphics_toolkit " - "gray " - "gray2ind " - "grid " - "griddata " - "griddata3 " - "griddatan " - "gt " - "gtext " - "gunzip " - "gzip " - "hadamard " - "hamming " - "hankel " - "hanning " - "help " - "hess " - "hex2dec " - "hex2num " - "hggroup " - "hidden " - "hilb " - "hist " - "histc " - "history " - "history_control " - "history_file " - "history_save " - "history_size " - "history_timestamp_format_string " - "hold " - "home " - "horzcat " - "hot " - "hotelling_test " - "hotelling_test_2 " - "housh " - "hsv " - "hsv2rgb " - "hurst " - "hygecdf " - "hygeinv " - "hygepdf " - "hygernd " - "hypot " - "i " - "idivide " - "if " - "ifelse " - "ifft " - "ifft2 " - "ifftn " - "ifftshift " - "ignore_function_time_stamp " - "imag " - "image " - "imagesc " - "imfinfo " - "imread " - "imshow " - "imwrite " - "ind2gray " - "ind2rgb " - "ind2sub " - "index " - "inf " - "inferiorto " - "info " - "info_file " - "info_program " - "inline " - "inpolygon " - "input " - "inputname " - "int16 " - "int2str " - "int32 " - "int64 " - "int8 " - "interp1 " - "interp1q " - "interp2 " - "interp3 " - "interpft " - "interpn " - "intersect " - "intmax " - "intmin " - "intwarning " - "inv " - "inverse " - "invhilb " - "ipermute " - "iqr " - "is_absolute_filename " - "is_duplicate_entry " - "is_global " - "is_leap_year " - "is_rooted_relative_filename " - "is_valid_file_id " - "isa " - "isalnum " - "isalpha " - "isappdata " - "isargout " - "isascii " - "isbool " - "iscell " - "iscellstr " - "ischar " - "iscntrl " - "iscolumn " - "iscommand " - "iscomplex " - "isdebugmode " - "isdefinite " - "isdeployed " - "isdigit " - "isdir " - "isempty " - "isequal " - "isequalwithequalnans " - "isfield " - "isfigure " - "isfinite " - "isfloat " - "isglobal " - "isgraph " - "ishandle " - "ishermitian " - "ishghandle " - "ishold " - "isieee " - "isindex " - "isinf " - "isinteger " - "iskeyword " - "isletter " - "islogical " - "islower " - "ismac " - "ismatrix " - "ismember " - "ismethod " - "isna " - "isnan " - "isnull " - "isnumeric " - "isobject " - "isocolors " - "isonormals " - "isosurface " - "ispc " - "isprime " - "isprint " - "isprop " - "ispunct " - "israwcommand " - "isreal " - "isrow " - "isscalar " - "issorted " - "isspace " - "issparse " - "issquare " - "isstr " - "isstrprop " - "isstruct " - "issymmetric " - "isunix " - "isupper " - "isvarname " - "isvector " - "isxdigit " - "j " - "jet " - "kbhit " - "kendall " - "keyboard " - "kill " - "kolmogorov_smirnov_cdf " - "kolmogorov_smirnov_test " - "kolmogorov_smirnov_test_2 " - "kron " - "kruskal_wallis_test " - "krylov " - "krylovb " - "kurtosis " - "laplace_cdf " - "laplace_inv " - "laplace_pdf " - "laplace_rnd " - "lasterr " - "lasterror " - "lastwarn " - "lchol " - "lcm " - "ldivide " - "le " - "legend " - "legendre " - "length " - "lgamma " - "license " - "lin2mu " - "line " - "link " - "linkprop " - "linspace " - "list " - "list_in_columns " - "list_primes " - "load " - "loadaudio " - "loadimage " - "loadobj " - "localtime " - "log " - "log10 " - "log1p " - "log2 " - "logical " - "logistic_cdf " - "logistic_inv " - "logistic_pdf " - "logistic_regression " - "logistic_rnd " - "logit " - "loglog " - "loglogerr " - "logm " - "logncdf " - "logninv " - "lognpdf " - "lognrnd " - "logspace " - "lookfor " - "lookup " - "lower " - "ls " - "ls_command " - "lsode " - "lsode_options " - "lsqnonneg " - "lstat " - "lt " - "lu " - "luinc " - "luupdate " - "magic " - "mahalanobis " - "make_absolute_filename " - "makeinfo_program " - "manova " - "mark_as_command " - "mark_as_rawcommand " - "mat2cell " - "mat2str " - "matlabroot " - "matrix_type " - "max " - "max_recursion_depth " - "mcnemar_test " - "md5sum " - "mean " - "meansq " - "median " - "menu " - "merge " - "mesh " - "meshc " - "meshgrid " - "meshz " - "methods " - "mex " - "mexext " - "mfilename " - "mgorth " - "min " - "minus " - "mislocked " - "missing_function_hook " - "mist " - "mkdir " - "mkfifo " - "mkoctfile " - "mkpp " - "mkstemp " - "mktime " - "mldivide " - "mlock " - "mod " - "mode " - "moment " - "more " - "most " - "movefile " - "mpoles " - "mpower " - "mrdivide " - "mtimes " - "mu2lin " - "munlock " - "namelengthmax " - "nan " - "nargchk " - "nargin " - "nargout " - "nargoutchk " - "native_float_format " - "nbincdf " - "nbininv " - "nbinpdf " - "nbinrnd " - "nchoosek " - "ndgrid " - "ndims " - "ne " - "newplot " - "news " - "nextpow2 " - "nfields " - "nnz " - "nonzeros " - "norm " - "normcdf " - "normest " - "norminv " - "normpdf " - "normrnd " - "not " - "now " - "nproc " - "nth_element " - "nthroot " - "ntsc2rgb " - "null " - "num2cell " - "num2hex " - "num2str " - "numel " - "nzmax " - "ocean " - "octave_config_info " - "octave_core_file_limit " - "octave_core_file_name " - "octave_core_file_options " - "octave_tmp_file_name " - "ols " - "onCleanup " - "onenormest " - "ones " - "optimget " - "optimize_subsasgn_calls " - "optimset " - "or " - "orderfields " - "orient " - "orth " - "otherwise " - "output_max_field_width " - "output_precision " - "pack " - "page_output_immediately " - "page_screen_output " - "paren " - "pareto " - "parseparams " - "pascal " - "patch " - "path " - "pathdef " - "pathsep " - "pause " - "pbaspect " - "pcg " - "pchip " - "pclose " - "pcolor " - "pcr " - "peaks " - "periodogram " - "perl " - "perms " - "permute " - "perror " - "persistent " - "pi " - "pie " - "pie3 " - "pink " - "pinv " - "pipe " - "pkg " - "planerot " - "playaudio " - "plot " - "plot3 " - "plotmatrix " - "plotyy " - "plus " - "poisscdf " - "poissinv " - "poisspdf " - "poissrnd " - "pol2cart " - "polar " - "poly " - "polyaffine " - "polyarea " - "polyder " - "polyderiv " - "polyfit " - "polygcd " - "polyint " - "polyout " - "polyreduce " - "polyval " - "polyvalm " - "popen " - "popen2 " - "postpad " - "pow2 " - "power " - "powerset " - "ppder " - "ppint " - "ppjumps " - "ppplot " - "ppval " - "pqpnonneg " - "prctile " - "prepad " - "primes " - "print " - "print_empty_dimensions " - "print_struct_array_contents " - "print_usage " - "printf " - "prism " - "probit " - "prod " - "program_invocation_name " - "program_name " - "prop_test_2 " - "putenv " - "puts " - "pwd " - "qp " - "qqplot " - "qr " - "qrdelete " - "qrinsert " - "qrshift " - "qrupdate " - "quad " - "quad_options " - "quadcc " - "quadgk " - "quadl " - "quadv " - "quantile " - "quit " - "quiver " - "quiver3 " - "qz " - "qzhess " - "rainbow " - "rand " - "rande " - "randg " - "randi " - "randn " - "randp " - "randperm " - "range " - "rank " - "ranks " - "rat " - "rats " - "rcond " - "rdivide " - "re_read_readline_init_file " - "readdir " - "readline_re_read_init_file " - "readline_read_init_file " - "readlink " - "real " - "reallog " - "realmax " - "realmin " - "realpow " - "realsqrt " - "record " - "rectangle " - "rectint " - "refresh " - "refreshdata " - "regexp " - "regexpi " - "regexprep " - "regexptranslate " - "rehash " - "rem " - "remove_input_event_hook " - "rename " - "repelems " - "replot " - "repmat " - "reset " - "reshape " - "residue " - "resize " - "restoredefaultpath " - "rethrow " - "return " - "rgb2hsv " - "rgb2ind " - "rgb2ntsc " - "ribbon " - "rindex " - "rmappdata " - "rmdir " - "rmfield " - "rmpath " - "roots " - "rose " - "rosser " - "rot90 " - "rotdim " - "round " - "roundb " - "rows " - "rref " - "rsf2csf " - "run " - "run_count " - "run_history " - "run_test " - "rundemos " - "runlength " - "runtests " - "save " - "save_default_options " - "save_header_format_string " - "save_precision " - "saveas " - "saveaudio " - "saveimage " - "saveobj " - "savepath " - "scanf " - "scatter " - "scatter3 " - "schur " - "sec " - "secd " - "sech " - "semicolon " - "semilogx " - "semilogxerr " - "semilogy " - "semilogyerr " - "set " - "setappdata " - "setaudio " - "setdiff " - "setenv " - "setfield " - "setgrent " - "setpwent " - "setstr " - "setxor " - "shading " - "shell_cmd " - "shg " - "shift " - "shiftdim " - "sighup_dumps_octave_core " - "sign " - "sign_test " - "sigterm_dumps_octave_core " - "silent_functions " - "sin " - "sinc " - "sind " - "sinetone " - "sinewave " - "single " - "sinh " - "size " - "size_equal " - "sizemax " - "sizeof " - "skewness " - "sleep " - "slice " - "sombrero " - "sort " - "sortrows " - "source " - "spalloc " - "sparse " - "sparse_auto_mutate " - "spatan2 " - "spaugment " - "spchol " - "spchol2inv " - "spcholinv " - "spconvert " - "spcumprod " - "spcumsum " - "spdet " - "spdiag " - "spdiags " - "spearman " - "spectral_adf " - "spectral_xdf " - "specular " - "speed " - "spencer " - "speye " - "spfind " - "spfun " - "sph2cart " - "sphcat " - "sphere " - "spinmap " - "spinv " - "spkron " - "splchol " - "spline " - "split " - "split_long_rows " - "splu " - "spmax " - "spmin " - "spones " - "spparms " - "spprod " - "spqr " - "sprand " - "sprandn " - "sprandsym " - "sprank " - "spring " - "sprintf " - "spstats " - "spsum " - "spsumsq " - "spvcat " - "spy " - "sqp " - "sqrt " - "sqrtm " - "squeeze " - "sscanf " - "stairs " - "stat " - "static " - "statistics " - "std " - "stderr " - "stdin " - "stdnormal_cdf " - "stdnormal_inv " - "stdnormal_pdf " - "stdnormal_rnd " - "stdout " - "stem " - "stem3 " - "stft " - "str2double " - "str2func " - "str2mat " - "str2num " - "strcat " - "strchr " - "strcmp " - "strcmpi " - "strerror " - "strfind " - "strftime " - "string_fill_char " - "strjust " - "strmatch " - "strncmp " - "strncmpi " - "strptime " - "strread " - "strrep " - "strsplit " - "strtok " - "strtrim " - "strtrunc " - "struct " - "struct2cell " - "struct_levels_to_print " - "structfun " - "strvcat " - "studentize " - "sub2ind " - "subplot " - "subsasgn " - "subsindex " - "subspace " - "subsref " - "substr " - "substruct " - "sum " - "summer " - "sumsq " - "superiorto " - "suppress_verbose_help_message " - "surf " - "surface " - "surfc " - "surfl " - "surfnorm " - "svd " - "svd_driver " - "svds " - "swapbytes " - "switch " - "syl " - "sylvester_matrix " - "symamd " - "symbfact " - "symlink " - "symrcm " - "symvar " - "synthesis " - "system " - "t_test " - "t_test_2 " - "t_test_regression " - "table " - "tan " - "tand " - "tanh " - "tar " - "tcdf " - "tempdir " - "tempname " - "terminal_size " - "test " - "test2 " - "test3 " - "text " - "textread " - "textscan " - "tic " - "tilde_expand " - "time " - "times " - "tinv " - "title " - "tmpfile " - "tmpnam " - "toascii " - "toc " - "toeplitz " - "tolower " - "toupper " - "tpdf " - "trace " - "transpose " - "trapz " - "treelayout " - "treeplot " - "tril " - "trimesh " - "triplequad " - "triplot " - "trisurf " - "triu " - "trnd " - "true " - "try " - "tsearch " - "tsearchn " - "type " - "typecast " - "typeinfo " - "u_test " - "uigetdir " - "uigetfile " - "uimenu " - "uint16 " - "uint32 " - "uint64 " - "uint8 " - "uiputfile " - "umask " - "uminus " - "uname " - "undo_string_escapes " - "unidcdf " - "unidinv " - "unidpdf " - "unidrnd " - "unifcdf " - "unifinv " - "unifpdf " - "unifrnd " - "union " - "unique " - "unix " - "unlink " - "unmark_command " - "unmark_rawcommand " - "unmkpp " - "unpack " - "untabify " - "untar " - "until " - "unwind_protect " - "unwind_protect_cleanup " - "unwrap " - "unzip " - "uplus " - "upper " - "urlread " - "urlwrite " - "usage " - "usleep " - "validatestring " - "values " - "vander " - "var " - "var_test " - "varargin " - "varargout " - "vec " - "vech " - "vectorize " - "ver " - "version " - "vertcat " - "view " - "voronoi " - "voronoin " - "waitforbuttonpress " - "waitpid " - "warning " - "warning_ids " - "warranty " - "wavread " - "wavwrite " - "wblcdf " - "wblinv " - "wblpdf " - "wblrnd " - "weekday " - "weibcdf " - "weibinv " - "weibpdf " - "weibrnd " - "welch_test " - "what " - "which " - "while " - "white " - "whitebg " - "who " - "whos " - "whos_line_format " - "wienrnd " - "wilcoxon_test " - "wilkinson " - "winter " - "xlabel " - "xlim " - "xor " - "yes_or_no " - "ylabel " - "ylim " - "yulewalker " - "z_test " - "z_test_2 " - "zeros " - "zip " - "zlabel " - "zlim "; - /* "break case catch continue do else elseif end end_unwind_protect " - "endfor endfunction endif endswitch endwhile for function " - "global if otherwise persistent return switch try until " - "unwind_protect unwind_protect_cleanup while"; - */ -} diff --git a/libgui/src/resource-manager.h b/libgui/src/resource-manager.h --- a/libgui/src/resource-manager.h +++ b/libgui/src/resource-manager.h @@ -81,8 +81,6 @@ return instance_ok () ? instance->do_is_first_run () : true; } - static const char *octave_keywords (void); - static QString storage_class_chars (void) { return "afghip"; } static QStringList storage_class_names (void); static QList storage_class_default_colors (void); diff --git a/libinterp/corefcn/file-io.cc b/libinterp/corefcn/file-io.cc --- a/libinterp/corefcn/file-io.cc +++ b/libinterp/corefcn/file-io.cc @@ -670,15 +670,6 @@ \n\ @item ieee-le\n\ IEEE little endian format.\n\ -\n\ -@item vaxd\n\ -VAX D floating format.\n\ -\n\ -@item vaxg\n\ -VAX G floating format.\n\ -\n\ -@item cray\n\ -Cray floating format.\n\ @end table\n\ \n\ @noindent\n\ @@ -1563,21 +1554,8 @@ \n\ @item \"ieee-le\"\n\ IEEE little endian.\n\ -\n\ -@item @qcode{\"vaxd\"}\n\ -VAX D floating format.\n\ -\n\ -@item @qcode{\"vaxg\"}\n\ -VAX G floating format.\n\ -\n\ -@item @qcode{\"cray\"}\n\ -Cray floating format.\n\ @end table\n\ \n\ -@noindent\n\ -Conversions are currently only supported for @qcode{\"ieee-be\"} and\n\ -@qcode{\"ieee-le\"} formats.\n\ -\n\ The data read from the file is returned in @var{val}, and the number of\n\ values read is returned in @code{count}\n\ @seealso{fwrite, fgets, fgetl, fscanf, fopen}\n\ diff --git a/libinterp/corefcn/ls-mat4.cc b/libinterp/corefcn/ls-mat4.cc --- a/libinterp/corefcn/ls-mat4.cc +++ b/libinterp/corefcn/ls-mat4.cc @@ -194,17 +194,8 @@ break; case 2: - flt_fmt = oct_mach_info::flt_fmt_vax_d; - break; - case 3: - flt_fmt = oct_mach_info::flt_fmt_vax_g; - break; - case 4: - flt_fmt = oct_mach_info::flt_fmt_cray; - break; - default: flt_fmt = oct_mach_info::flt_fmt_unknown; break; @@ -228,18 +219,6 @@ retval = 1; break; - case oct_mach_info::flt_fmt_vax_d: - retval = 2; - break; - - case oct_mach_info::flt_fmt_vax_g: - retval = 3; - break; - - case oct_mach_info::flt_fmt_cray: - retval = 4; - break; - default: break; } diff --git a/libinterp/corefcn/mex.cc b/libinterp/corefcn/mex.cc --- a/libinterp/corefcn/mex.cc +++ b/libinterp/corefcn/mex.cc @@ -1164,7 +1164,7 @@ switch (get_class_id ()) { case mxLOGICAL_CLASS: - retval = int_to_ov (dv); + retval = int_to_ov (dv); break; case mxCHAR_CLASS: diff --git a/libinterp/corefcn/oct-stream.cc b/libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc +++ b/libinterp/corefcn/oct-stream.cc @@ -1189,29 +1189,6 @@ return is >> valptr; } -template std::istream& -octave_scan (std::istream&, const scanf_format_elt&, int*); - -template std::istream& -octave_scan (std::istream&, const scanf_format_elt&, long int*); - -template std::istream& -octave_scan (std::istream&, const scanf_format_elt&, short int*); - -template std::istream& -octave_scan (std::istream&, const scanf_format_elt&, unsigned int*); - -template std::istream& -octave_scan (std::istream&, const scanf_format_elt&, unsigned long int*); - -template std::istream& -octave_scan (std::istream&, const scanf_format_elt&, unsigned short int*); - -#if 0 -template std::istream& -octave_scan (std::istream&, const scanf_format_elt&, float*); -#endif - template<> std::istream& octave_scan<> (std::istream& is, const scanf_format_elt& fmt, double* valptr) @@ -1278,36 +1255,6 @@ } template void -do_scanf_conv (std::istream&, const scanf_format_elt&, int*, - Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); - -template void -do_scanf_conv (std::istream&, const scanf_format_elt&, long int*, - Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); - -template void -do_scanf_conv (std::istream&, const scanf_format_elt&, short int*, - Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); - -template void -do_scanf_conv (std::istream&, const scanf_format_elt&, unsigned int*, - Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); - -template void -do_scanf_conv (std::istream&, const scanf_format_elt&, unsigned long int*, - Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); - -template void -do_scanf_conv (std::istream&, const scanf_format_elt&, unsigned short int*, - Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); - -#if 0 -template void -do_scanf_conv (std::istream&, const scanf_format_elt&, float*, - Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); -#endif - -template void do_scanf_conv (std::istream&, const scanf_format_elt&, double*, Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); @@ -2402,30 +2349,6 @@ return retval; } -template int -do_printf_conv (std::ostream&, const char*, int, int, int, int, - const std::string&); - -template int -do_printf_conv (std::ostream&, const char*, int, int, int, long, - const std::string&); - -template int -do_printf_conv (std::ostream&, const char*, int, int, int, unsigned int, - const std::string&); - -template int -do_printf_conv (std::ostream&, const char*, int, int, int, unsigned long, - const std::string&); - -template int -do_printf_conv (std::ostream&, const char*, int, int, int, double, - const std::string&); - -template int -do_printf_conv (std::ostream&, const char*, int, int, int, const char*, - const std::string&); - #define DO_DOUBLE_CONV(TQUAL) \ do \ { \ @@ -3079,14 +3002,10 @@ max_size = 32; } - // FIXME -- byte order for Cray? - bool swap = false; if (oct_mach_info::words_big_endian ()) - swap = (from_flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian - || from_flt_fmt == oct_mach_info::flt_fmt_vax_g - || from_flt_fmt == oct_mach_info::flt_fmt_vax_g); + swap = (from_flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian); else swap = (from_flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian); @@ -3203,44 +3122,11 @@ return retval; } -#define DO_READ_VAL_TEMPLATE(RET_T, READ_T) \ - template octave_value \ - do_read (octave_stream&, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type, bool, bool, \ - oct_mach_info::float_format, octave_idx_type&) - -// FIXME -- should we only have float if it is a different -// size from double? - -#define INSTANTIATE_DO_READ(VAL_T) \ - DO_READ_VAL_TEMPLATE (VAL_T, octave_int8); \ - DO_READ_VAL_TEMPLATE (VAL_T, octave_uint8); \ - DO_READ_VAL_TEMPLATE (VAL_T, octave_int16); \ - DO_READ_VAL_TEMPLATE (VAL_T, octave_uint16); \ - DO_READ_VAL_TEMPLATE (VAL_T, octave_int32); \ - DO_READ_VAL_TEMPLATE (VAL_T, octave_uint32); \ - DO_READ_VAL_TEMPLATE (VAL_T, octave_int64); \ - DO_READ_VAL_TEMPLATE (VAL_T, octave_uint64); \ - DO_READ_VAL_TEMPLATE (VAL_T, float); \ - DO_READ_VAL_TEMPLATE (VAL_T, double); \ - DO_READ_VAL_TEMPLATE (VAL_T, char); \ - DO_READ_VAL_TEMPLATE (VAL_T, signed char); \ - DO_READ_VAL_TEMPLATE (VAL_T, unsigned char) - -INSTANTIATE_DO_READ (int8NDArray); -INSTANTIATE_DO_READ (uint8NDArray); -INSTANTIATE_DO_READ (int16NDArray); -INSTANTIATE_DO_READ (uint16NDArray); -INSTANTIATE_DO_READ (int32NDArray); -INSTANTIATE_DO_READ (uint32NDArray); -INSTANTIATE_DO_READ (int64NDArray); -INSTANTIATE_DO_READ (uint64NDArray); -INSTANTIATE_DO_READ (FloatNDArray); -INSTANTIATE_DO_READ (NDArray); -INSTANTIATE_DO_READ (charNDArray); -INSTANTIATE_DO_READ (boolNDArray); - -typedef octave_value (*read_fptr) (octave_stream&, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type, bool, bool, - oct_mach_info::float_format ffmt, octave_idx_type&); +typedef octave_value (*read_fptr) (octave_stream&, octave_idx_type, + octave_idx_type, octave_idx_type, + octave_idx_type, bool, bool, + oct_mach_info::float_format ffmt, + octave_idx_type&); #define FILL_TABLE_ROW(R, VAL_T) \ read_fptr_table[R][oct_data_conv::dt_int8] = do_read; \ @@ -3385,103 +3271,106 @@ return retval; } -template -void -write_int (std::ostream& os, bool swap, const T& val) +template +static void +convert_ints (const T *data, void *conv_data, octave_idx_type n_elts, + bool swap) { - typename T::val_type tmp = val.value (); - - if (swap) - swap_bytes (&tmp); - - os.write (reinterpret_cast (&tmp), - sizeof (typename T::val_type)); + typedef typename V::val_type val_type; + + val_type *vt_data = static_cast (conv_data); + + for (octave_idx_type i = 0; i < n_elts; i++) + { + V val (data[i]); + + vt_data[i] = val.value (); + + if (swap) + swap_bytes (&vt_data[i]); + } } -template void write_int (std::ostream&, bool, const octave_int8&); -template void write_int (std::ostream&, bool, const octave_uint8&); -template void write_int (std::ostream&, bool, const octave_int16&); -template void write_int (std::ostream&, bool, const octave_uint16&); -template void write_int (std::ostream&, bool, const octave_int32&); -template void write_int (std::ostream&, bool, const octave_uint32&); -template void write_int (std::ostream&, bool, const octave_int64&); -template void write_int (std::ostream&, bool, const octave_uint64&); - template -static inline bool -do_write (std::ostream& os, const T& val, oct_data_conv::data_type output_type, - oct_mach_info::float_format flt_fmt, bool swap, - bool do_float_conversion) +static bool +convert_data (const T *data, void *conv_data, octave_idx_type n_elts, + oct_data_conv::data_type output_type, + oct_mach_info::float_format flt_fmt) { bool retval = true; - // For compatibility, Octave converts to the output type, then - // writes. This means that truncation happens on the conversion. - // For example, the following program prints 0: - // - // x = int8 (-1) - // f = fopen ("foo.dat", "w"); - // fwrite (f, x, "unsigned char"); - // fclose (f); - // f = fopen ("foo.dat", "r"); - // y = fread (f, 1, "unsigned char"); - // printf ("%d\n", y); + bool swap + = ((oct_mach_info::words_big_endian () + && flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian) + || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian); + + bool do_float_conversion = flt_fmt != oct_mach_info::float_format (); + + // We use octave_intN classes here instead of converting directly to + // intN_t so that we get integer saturation semantics. switch (output_type) { case oct_data_conv::dt_char: case oct_data_conv::dt_schar: case oct_data_conv::dt_int8: - write_int (os, swap, octave_int8 (val)); + convert_ints (data, conv_data, n_elts, swap); break; case oct_data_conv::dt_uchar: case oct_data_conv::dt_uint8: - write_int (os, swap, octave_uint8 (val)); + convert_ints (data, conv_data, n_elts, swap); break; case oct_data_conv::dt_int16: - write_int (os, swap, octave_int16 (val)); + convert_ints (data, conv_data, n_elts, swap); break; case oct_data_conv::dt_uint16: - write_int (os, swap, octave_uint16 (val)); + convert_ints (data, conv_data, n_elts, swap); break; case oct_data_conv::dt_int32: - write_int (os, swap, octave_int32 (val)); + convert_ints (data, conv_data, n_elts, swap); break; case oct_data_conv::dt_uint32: - write_int (os, swap, octave_uint32 (val)); + convert_ints (data, conv_data, n_elts, swap); break; case oct_data_conv::dt_int64: - write_int (os, swap, octave_int64 (val)); + convert_ints (data, conv_data, n_elts, swap); break; case oct_data_conv::dt_uint64: - write_int (os, swap, octave_uint64 (val)); + convert_ints (data, conv_data, n_elts, swap); break; case oct_data_conv::dt_single: { - float f = static_cast (val); - - if (do_float_conversion) - do_float_format_conversion (&f, 1, flt_fmt); - - os.write (reinterpret_cast (&f), sizeof (float)); + float *vt_data = static_cast (conv_data); + + for (octave_idx_type i = 0; i < n_elts; i++) + { + vt_data[i] = data[i]; + + if (do_float_conversion) + do_float_format_conversion (&vt_data[i], 1, flt_fmt); + } } break; case oct_data_conv::dt_double: { - double d = static_cast (val); - if (do_float_conversion) - do_double_format_conversion (&d, 1, flt_fmt); - - os.write (reinterpret_cast (&d), sizeof (double)); + double *vt_data = static_cast (conv_data); + + for (octave_idx_type i = 0; i < n_elts; i++) + { + vt_data[i] = data[i]; + + if (do_float_conversion) + do_double_format_conversion (&vt_data[i], 1, flt_fmt); + } } break; @@ -3495,198 +3384,174 @@ return retval; } -template bool -do_write (std::ostream&, const octave_int8&, oct_data_conv::data_type, - oct_mach_info::float_format, bool, bool); - -template bool -do_write (std::ostream&, const octave_uint8&, oct_data_conv::data_type, - oct_mach_info::float_format, bool, bool); - -template bool -do_write (std::ostream&, const octave_int16&, oct_data_conv::data_type, - oct_mach_info::float_format, bool, bool); - -template bool -do_write (std::ostream&, const octave_uint16&, oct_data_conv::data_type, - oct_mach_info::float_format, bool, bool); - -template bool -do_write (std::ostream&, const octave_int32&, oct_data_conv::data_type, - oct_mach_info::float_format, bool, bool); - -template bool -do_write (std::ostream&, const octave_uint32&, oct_data_conv::data_type, - oct_mach_info::float_format, bool, bool); - -template bool -do_write (std::ostream&, const octave_int64&, oct_data_conv::data_type, - oct_mach_info::float_format, bool, bool); - -template bool -do_write (std::ostream&, const octave_uint64&, oct_data_conv::data_type, - oct_mach_info::float_format, bool, bool); +bool +octave_stream::write_bytes (const void *data, size_t nbytes) +{ + bool status = false; + + std::ostream *osp = output_stream (); + + if (osp) + { + std::ostream& os = *osp; + + if (os) + { + os.write (static_cast (data), nbytes); + + if (os) + status = true; + } + } + + return status; +} + +bool +octave_stream::skip_bytes (size_t skip) +{ + bool status = false; + + std::ostream *osp = output_stream (); + + if (osp) + { + std::ostream& os = *osp; + + // Seek to skip when inside bounds of existing file. + // Otherwise, write NUL to skip. + + off_t orig_pos = tell (); + + seek (0, SEEK_END); + + off_t eof_pos = tell (); + + // Is it possible for this to fail to return us to the + // original position? + seek (orig_pos, SEEK_SET); + + size_t remaining = eof_pos - orig_pos; + + if (remaining < skip) + { + seek (0, SEEK_END); + + // FIXME -- probably should try to write larger blocks... + + unsigned char zero = 0; + for (size_t j = 0; j < skip - remaining; j++) + os.write (reinterpret_cast (&zero), 1); + } + else + seek (skip, SEEK_CUR); + + if (os) + status = true; + } + + return status; +} template octave_idx_type octave_stream::write (const Array& data, octave_idx_type block_size, oct_data_conv::data_type output_type, - octave_idx_type skip, oct_mach_info::float_format flt_fmt) + octave_idx_type skip, + oct_mach_info::float_format flt_fmt) { - octave_idx_type retval = -1; - - bool status = true; - - octave_idx_type count = 0; - - const T *d = data.data (); - - octave_idx_type n = data.length (); - - oct_mach_info::float_format native_flt_fmt - = oct_mach_info::float_format (); - - bool do_float_conversion = (flt_fmt != native_flt_fmt); - - // FIXME -- byte order for Cray? - - bool swap = false; - - if (oct_mach_info::words_big_endian ()) - swap = (flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian - || flt_fmt == oct_mach_info::flt_fmt_vax_g - || flt_fmt == oct_mach_info::flt_fmt_vax_g); + bool swap + = ((oct_mach_info::words_big_endian () + && flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian) + || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian); + + bool do_data_conversion + = (swap || ! is_equivalent_type (output_type) + || flt_fmt != oct_mach_info::float_format ()); + + octave_idx_type nel = data.numel (); + + octave_idx_type chunk_size; + + if (skip != 0) + chunk_size = block_size; + else if (do_data_conversion) + chunk_size = 1024 * 1024; else - swap = (flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian); - - for (octave_idx_type i = 0; i < n; i++) + chunk_size = nel; + + octave_idx_type i = 0; + + const T *pdata = data.data (); + + while (i < nel) { - std::ostream *osp = output_stream (); - - if (osp) + if (skip != 0) { - std::ostream& os = *osp; - - if (skip != 0 && (i % block_size) == 0) - { - // Seek to skip when inside bounds of existing file. - // Otherwise, write NUL to skip. - - off_t orig_pos = tell (); - - seek (0, SEEK_END); - - off_t eof_pos = tell (); - - // Is it possible for this to fail to return us to the - // original position? - seek (orig_pos, SEEK_SET); - - off_t remaining = eof_pos - orig_pos; - - if (remaining < skip) - { - seek (0, SEEK_END); - - // FIXME -- probably should try to write larger - // blocks... - - unsigned char zero = 0; - for (octave_idx_type j = 0; j < skip - remaining; j++) - os.write (reinterpret_cast (&zero), 1); - } - else - seek (skip, SEEK_CUR); - } - - if (os) - { - status = do_write (os, d[i], output_type, flt_fmt, swap, - do_float_conversion); - - if (os && status) - count++; - else - break; - } - else - { - status = false; - break; - } + if (! skip_bytes (skip)) + return -1; + } + + octave_idx_type remaining_nel = nel - i; + + if (chunk_size > remaining_nel) + chunk_size = remaining_nel; + + bool status = false; + + if (do_data_conversion) + { + size_t output_size + = chunk_size * oct_data_conv::data_type_size (output_type); + + OCTAVE_LOCAL_BUFFER (unsigned char, conv_data, output_size); + + status = convert_data (&pdata[i], conv_data, chunk_size, + output_type, flt_fmt); + + if (status) + status = write_bytes (conv_data, output_size); } else - { - status = false; - break; - } + status = write_bytes (pdata, sizeof (T) * chunk_size); + + if (! status) + return -1; + + i += chunk_size; } - if (status) - retval = count; - - return retval; + return nel; } -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); - -template octave_idx_type -octave_stream::write (const Array&, octave_idx_type, - oct_data_conv::data_type, - octave_idx_type, oct_mach_info::float_format); +#define INSTANTIATE_WRITE(T) \ + template \ + octave_idx_type \ + octave_stream::write (const Array& data, octave_idx_type block_size, \ + oct_data_conv::data_type output_type, \ + octave_idx_type skip, \ + oct_mach_info::float_format flt_fmt) + +INSTANTIATE_WRITE (octave_int8); +INSTANTIATE_WRITE (octave_uint8); +INSTANTIATE_WRITE (octave_int16); +INSTANTIATE_WRITE (octave_uint16); +INSTANTIATE_WRITE (octave_int32); +INSTANTIATE_WRITE (octave_uint32); +INSTANTIATE_WRITE (octave_int64); +INSTANTIATE_WRITE (octave_uint64); +INSTANTIATE_WRITE (int8_t); +INSTANTIATE_WRITE (uint8_t); +INSTANTIATE_WRITE (int16_t); +INSTANTIATE_WRITE (uint16_t); +INSTANTIATE_WRITE (int32_t); +INSTANTIATE_WRITE (uint32_t); +INSTANTIATE_WRITE (int64_t); +INSTANTIATE_WRITE (uint64_t); +INSTANTIATE_WRITE (bool); +INSTANTIATE_WRITE (char); +INSTANTIATE_WRITE (float); +INSTANTIATE_WRITE (double); octave_value octave_stream::scanf (const std::string& fmt, const Array& size, diff --git a/libinterp/corefcn/oct-stream.h b/libinterp/corefcn/oct-stream.h --- a/libinterp/corefcn/oct-stream.h +++ b/libinterp/corefcn/oct-stream.h @@ -37,6 +37,7 @@ #include "data-conv.h" #include "lo-utils.h" #include "mach-info.h" +#include "oct-locbuf.h" #include "oct-refcount.h" class @@ -539,13 +540,19 @@ octave_idx_type& count); octave_idx_type write (const octave_value& data, octave_idx_type block_size, - oct_data_conv::data_type output_type, - octave_idx_type skip, oct_mach_info::float_format flt_fmt); + oct_data_conv::data_type output_type, + octave_idx_type skip, + oct_mach_info::float_format flt_fmt); + + bool write_bytes (const void *data, size_t n_elts); + + bool skip_bytes (size_t n_elts); template - octave_idx_type write (const Array&, octave_idx_type block_size, - oct_data_conv::data_type output_type, - octave_idx_type skip, oct_mach_info::float_format flt_fmt); + octave_idx_type write (const Array& data, octave_idx_type block_size, + oct_data_conv::data_type output_type, + octave_idx_type skip, + oct_mach_info::float_format flt_fmt); octave_value scanf (const std::string& fmt, const Array& size, octave_idx_type& count, const std::string& who /* = "scanf" */); diff --git a/libinterp/corefcn/pr-output.cc b/libinterp/corefcn/pr-output.cc --- a/libinterp/corefcn/pr-output.cc +++ b/libinterp/corefcn/pr-output.cc @@ -1459,9 +1459,6 @@ // Unless explicitly asked for, always print in big-endian // format. - // FIXME -- is it correct to swap bytes for VAX - // formats and not for Cray? - // FIXME -- will bad things happen if we are // interrupted before resetting the format flags and fill // character? @@ -1475,9 +1472,7 @@ = os.flags (std::ios::right | std::ios::hex); if (hex_format > 1 - || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian - || flt_fmt == oct_mach_info::flt_fmt_cray - || flt_fmt == oct_mach_info::flt_fmt_unknown) + || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian) { for (size_t i = 0; i < sizeof (double); i++) os << std::setw (2) << static_cast (tmp.i[i]); @@ -1496,15 +1491,10 @@ equiv tmp; tmp.d = d; - // FIXME -- is it correct to swap bytes for VAX - // formats and not for Cray? - oct_mach_info::float_format flt_fmt = oct_mach_info::native_float_format (); - if (flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian - || flt_fmt == oct_mach_info::flt_fmt_cray - || flt_fmt == oct_mach_info::flt_fmt_unknown) + if (flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian) { for (size_t i = 0; i < sizeof (double); i++) PRINT_CHAR_BITS (os, tmp.i[i]); diff --git a/liboctave/system/mach-info.cc b/liboctave/system/mach-info.cc --- a/liboctave/system/mach-info.cc +++ b/liboctave/system/mach-info.cc @@ -75,14 +75,6 @@ { oct_mach_info::float_format retval = oct_mach_info::flt_fmt_unknown; -#if defined (CRAY) - - // FIXME -- this should be determined automatically. - - native_float_fmt = oct_mach_info::flt_fmt_cray; - -#else - float_params fp[5]; INIT_FLT_PAR (fp[0], oct_mach_info::flt_fmt_ieee_big_endian, @@ -97,18 +89,6 @@ 0, 1017118720, 0, 1018167296); - INIT_FLT_PAR (fp[2], oct_mach_info::flt_fmt_vax_d, - 128, 0, - -32769, -1, - 9344, 0, - 9344, 0); - - INIT_FLT_PAR (fp[3], oct_mach_info::flt_fmt_vax_g, - 16, 0, - -32769, -1, - 15552, 0, - 15552, 0); - INIT_FLT_PAR (fp[4], oct_mach_info::flt_fmt_unknown, 0, 0, 0, 0, @@ -133,8 +113,6 @@ } while (fp[++i].fp_fmt != oct_mach_info::flt_fmt_unknown); -#endif - return retval; } @@ -214,12 +192,6 @@ retval = oct_mach_info::flt_fmt_ieee_big_endian; else if (s == "ieee-le" || s == "l") retval = oct_mach_info::flt_fmt_ieee_little_endian; - else if (s == "vaxd" || s == "d") - retval = oct_mach_info::flt_fmt_vax_d; - else if (s == "vaxg" || s == "g") - retval = oct_mach_info::flt_fmt_vax_g; - else if (s == "cray" || s == "c") - retval = oct_mach_info::flt_fmt_cray; else if (s == "unknown") retval = oct_mach_info::flt_fmt_unknown; else @@ -244,18 +216,6 @@ retval = "ieee-le"; break; - case flt_fmt_vax_d: - retval = "vaxd"; - break; - - case flt_fmt_vax_g: - retval = "vaxg"; - break; - - case flt_fmt_cray: - retval = "cray"; - break; - default: break; } diff --git a/liboctave/system/mach-info.h b/liboctave/system/mach-info.h --- a/liboctave/system/mach-info.h +++ b/liboctave/system/mach-info.h @@ -40,9 +40,6 @@ flt_fmt_unknown, flt_fmt_ieee_little_endian, flt_fmt_ieee_big_endian, - flt_fmt_vax_d, - flt_fmt_vax_g, - flt_fmt_cray }; static bool instance_ok (void); diff --git a/liboctave/util/data-conv.cc b/liboctave/util/data-conv.cc --- a/liboctave/util/data-conv.cc +++ b/liboctave/util/data-conv.cc @@ -174,6 +174,111 @@ } \ while (0) +size_t +oct_data_conv::data_type_size (data_type dt) +{ + size_t retval = -1; + + switch (dt) + { + case oct_data_conv::dt_int8: + retval = sizeof (int8_t); + break; + + case oct_data_conv::dt_uint8: + retval = sizeof (uint8_t); + break; + + case oct_data_conv::dt_int16: + retval = sizeof (int16_t); + break; + + case oct_data_conv::dt_uint16: + retval = sizeof (uint16_t); + break; + + case oct_data_conv::dt_int32: + retval = sizeof (int32_t); + break; + + case oct_data_conv::dt_uint32: + retval = sizeof (uint32_t); + break; + + case oct_data_conv::dt_int64: + retval = sizeof (int64_t); + break; + + case oct_data_conv::dt_uint64: + retval = sizeof (uint64_t); + break; + + case oct_data_conv::dt_float: + case oct_data_conv::dt_single: + retval = sizeof (float); + break; + + case oct_data_conv::dt_double: + retval = sizeof (double); + break; + + case oct_data_conv::dt_char: + retval = sizeof (char); + break; + + case oct_data_conv::dt_schar: + retval = sizeof (signed char); + break; + + case oct_data_conv::dt_uchar: + retval = sizeof (unsigned char); + break; + + case oct_data_conv::dt_short: + retval = sizeof (short); + break; + + case oct_data_conv::dt_ushort: + retval = sizeof (unsigned short); + break; + + case oct_data_conv::dt_int: + retval = sizeof (int); + break; + + case oct_data_conv::dt_uint: + retval = sizeof (unsigned int); + break; + + case oct_data_conv::dt_long: + retval = sizeof (long); + break; + + case oct_data_conv::dt_ulong: + retval = sizeof (unsigned long); + break; + + case oct_data_conv::dt_longlong: + retval = sizeof (long long); + break; + + case oct_data_conv::dt_ulonglong: + retval = sizeof (unsigned long long); + break; + + case oct_data_conv::dt_logical: + retval = sizeof (bool); + break; + + case oct_data_conv::dt_unknown: + default: + abort (); + break; + } + + return retval; +} + oct_data_conv::data_type oct_data_conv::string_to_data_type (const std::string& str) { @@ -426,7 +531,7 @@ break; case oct_data_conv::dt_uchar: - retval = "usigned char"; + retval = "unsigned char"; break; case oct_data_conv::dt_short: @@ -442,7 +547,7 @@ break; case oct_data_conv::dt_uint: - retval = "usigned int"; + retval = "unsigned int"; break; case oct_data_conv::dt_long: @@ -450,7 +555,7 @@ break; case oct_data_conv::dt_ulong: - retval = "usigned long"; + retval = "unsigned long"; break; case oct_data_conv::dt_longlong: @@ -545,191 +650,23 @@ } static void -VAX_D_double_to_IEEE_little_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX D float", "IEEE little endian format"); -} - -static void -VAX_G_double_to_IEEE_little_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX G float", "IEEE little endian format"); -} - -static void -Cray_to_IEEE_little_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("Cray", "IEEE little endian format"); -} - -static void IEEE_big_float_to_IEEE_little_float (void *d, octave_idx_type len) { swap_bytes<4> (d, len); } static void -VAX_D_float_to_IEEE_little_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX D float", "IEEE little endian format"); -} - -static void -VAX_G_float_to_IEEE_little_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX G float", "IEEE little endian format"); -} - -static void -Cray_to_IEEE_little_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("Cray", "IEEE little endian format"); -} - -static void IEEE_little_double_to_IEEE_big_double (void *d, octave_idx_type len) { swap_bytes<8> (d, len); } static void -VAX_D_double_to_IEEE_big_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX D float", "IEEE big endian format"); -} - -static void -VAX_G_double_to_IEEE_big_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX G float", "IEEE big endian format"); -} - -static void -Cray_to_IEEE_big_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("Cray", "IEEE big endian format"); -} - -static void IEEE_little_float_to_IEEE_big_float (void *d, octave_idx_type len) { swap_bytes<4> (d, len); } -static void -VAX_D_float_to_IEEE_big_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX D float", "IEEE big endian format"); -} - -static void -VAX_G_float_to_IEEE_big_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX G float", "IEEE big endian format"); -} - -static void -Cray_to_IEEE_big_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("Cray", "IEEE big endian format"); -} - -static void -IEEE_little_double_to_VAX_D_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("IEEE little endian", "VAX D"); -} - -static void -IEEE_big_double_to_VAX_D_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("IEEE big endian", "VAX D"); -} - -static void -VAX_G_double_to_VAX_D_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX G float", "VAX D"); -} - -static void -Cray_to_VAX_D_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("Cray", "VAX D"); -} - -static void -IEEE_little_float_to_VAX_D_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("IEEE little endian", "VAX D"); -} - -static void -IEEE_big_float_to_VAX_D_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("IEEE big endian", "VAX D"); -} - -static void -VAX_G_float_to_VAX_D_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX G float", "VAX D"); -} - -static void -Cray_to_VAX_D_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("Cray", "VAX D"); -} - -static void -IEEE_little_double_to_VAX_G_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("IEEE little endian", "VAX G"); -} - -static void -IEEE_big_double_to_VAX_G_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("IEEE big endian", "VAX G"); -} - -static void -VAX_D_double_to_VAX_G_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX D float", "VAX G"); -} - -static void -Cray_to_VAX_G_double (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX G float", "VAX G"); -} - -static void -IEEE_little_float_to_VAX_G_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("IEEE little endian", "VAX G"); -} - -static void -IEEE_big_float_to_VAX_G_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("IEEE big endian", "VAX G"); -} - -static void -VAX_D_float_to_VAX_G_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX D float", "VAX G"); -} - -static void -Cray_to_VAX_G_float (void * /* d */, octave_idx_type /* len */) -{ - gripe_data_conversion ("VAX G float", "VAX G"); -} - void do_double_format_conversion (void *data, octave_idx_type len, oct_mach_info::float_format from_fmt, @@ -747,18 +684,6 @@ IEEE_big_double_to_IEEE_little_double (data, len); break; - case oct_mach_info::flt_fmt_vax_d: - VAX_D_double_to_IEEE_little_double (data, len); - break; - - case oct_mach_info::flt_fmt_vax_g: - VAX_G_double_to_IEEE_little_double (data, len); - break; - - case oct_mach_info::flt_fmt_cray: - Cray_to_IEEE_little_double (data, len); - break; - default: gripe_unrecognized_float_fmt (); break; @@ -775,74 +700,6 @@ case oct_mach_info::flt_fmt_ieee_big_endian: break; - case oct_mach_info::flt_fmt_vax_d: - VAX_D_double_to_IEEE_big_double (data, len); - break; - - case oct_mach_info::flt_fmt_vax_g: - VAX_G_double_to_IEEE_big_double (data, len); - break; - - case oct_mach_info::flt_fmt_cray: - Cray_to_IEEE_big_double (data, len); - break; - - default: - gripe_unrecognized_float_fmt (); - break; - } - break; - - case oct_mach_info::flt_fmt_vax_d: - switch (from_fmt) - { - case oct_mach_info::flt_fmt_ieee_little_endian: - IEEE_little_double_to_VAX_D_double (data, len); - break; - - case oct_mach_info::flt_fmt_ieee_big_endian: - IEEE_big_double_to_VAX_D_double (data, len); - break; - - case oct_mach_info::flt_fmt_vax_d: - break; - - case oct_mach_info::flt_fmt_vax_g: - VAX_G_double_to_VAX_D_double (data, len); - break; - - case oct_mach_info::flt_fmt_cray: - Cray_to_VAX_D_double (data, len); - break; - - default: - gripe_unrecognized_float_fmt (); - break; - } - break; - - case oct_mach_info::flt_fmt_vax_g: - switch (from_fmt) - { - case oct_mach_info::flt_fmt_ieee_little_endian: - IEEE_little_double_to_VAX_G_double (data, len); - break; - - case oct_mach_info::flt_fmt_ieee_big_endian: - IEEE_big_double_to_VAX_G_double (data, len); - break; - - case oct_mach_info::flt_fmt_vax_d: - VAX_D_double_to_VAX_G_double (data, len); - break; - - case oct_mach_info::flt_fmt_vax_g: - break; - - case oct_mach_info::flt_fmt_cray: - Cray_to_VAX_G_double (data, len); - break; - default: gripe_unrecognized_float_fmt (); break; @@ -874,18 +731,6 @@ IEEE_big_float_to_IEEE_little_float (data, len); break; - case oct_mach_info::flt_fmt_vax_d: - VAX_D_float_to_IEEE_little_float (data, len); - break; - - case oct_mach_info::flt_fmt_vax_g: - VAX_G_float_to_IEEE_little_float (data, len); - break; - - case oct_mach_info::flt_fmt_cray: - Cray_to_IEEE_little_float (data, len); - break; - default: gripe_unrecognized_float_fmt (); break; @@ -902,74 +747,6 @@ case oct_mach_info::flt_fmt_ieee_big_endian: break; - case oct_mach_info::flt_fmt_vax_d: - VAX_D_float_to_IEEE_big_float (data, len); - break; - - case oct_mach_info::flt_fmt_vax_g: - VAX_G_float_to_IEEE_big_float (data, len); - break; - - case oct_mach_info::flt_fmt_cray: - Cray_to_IEEE_big_float (data, len); - break; - - default: - gripe_unrecognized_float_fmt (); - break; - } - break; - - case oct_mach_info::flt_fmt_vax_d: - switch (from_fmt) - { - case oct_mach_info::flt_fmt_ieee_little_endian: - IEEE_little_float_to_VAX_D_float (data, len); - break; - - case oct_mach_info::flt_fmt_ieee_big_endian: - IEEE_big_float_to_VAX_D_float (data, len); - break; - - case oct_mach_info::flt_fmt_vax_d: - break; - - case oct_mach_info::flt_fmt_vax_g: - VAX_G_float_to_VAX_D_float (data, len); - break; - - case oct_mach_info::flt_fmt_cray: - Cray_to_VAX_D_float (data, len); - break; - - default: - gripe_unrecognized_float_fmt (); - break; - } - break; - - case oct_mach_info::flt_fmt_vax_g: - switch (from_fmt) - { - case oct_mach_info::flt_fmt_ieee_little_endian: - IEEE_little_float_to_VAX_G_float (data, len); - break; - - case oct_mach_info::flt_fmt_ieee_big_endian: - IEEE_big_float_to_VAX_G_float (data, len); - break; - - case oct_mach_info::flt_fmt_vax_d: - VAX_D_float_to_VAX_G_float (data, len); - break; - - case oct_mach_info::flt_fmt_vax_g: - break; - - case oct_mach_info::flt_fmt_cray: - Cray_to_VAX_G_float (data, len); - break; - default: gripe_unrecognized_float_fmt (); break; diff --git a/liboctave/util/data-conv.h b/liboctave/util/data-conv.h --- a/liboctave/util/data-conv.h +++ b/liboctave/util/data-conv.h @@ -26,6 +26,7 @@ #include #include "mach-info.h" +#include "oct-inttypes.h" class OCTAVE_API @@ -61,6 +62,8 @@ dt_unknown = 23 // Must be last, have largest value! }; + static size_t data_type_size (data_type dt); + static data_type string_to_data_type (const std::string& s); static void string_to_data_type (const std::string& s, int& block_size, @@ -125,4 +128,137 @@ write_floats (std::ostream& os, const float *data, save_type type, octave_idx_type len); +template +inline bool +is_equivalent_type (oct_data_conv::data_type) +{ + return false; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_int8; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_int16; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_int32; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_int64; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_uint8; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_uint16; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_uint32; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_uint64; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_int8; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_int16; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_int32; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_int64; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_uint8; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_uint16; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_uint32; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_uint64; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_double; +} + +template <> +inline bool +is_equivalent_type (oct_data_conv::data_type t) +{ + return t == oct_data_conv::dt_single || t == oct_data_conv::dt_float; +} + #endif diff --git a/liboctave/util/lo-ieee.cc b/liboctave/util/lo-ieee.cc --- a/liboctave/util/lo-ieee.cc +++ b/liboctave/util/lo-ieee.cc @@ -73,9 +73,6 @@ } break; - case oct_mach_info::flt_fmt_cray: - case oct_mach_info::flt_fmt_vax_d: - case oct_mach_info::flt_fmt_vax_g: default: // If the format is unknown, then you will probably not have a // useful system, so we will abort here. Anyone wishing to diff --git a/scripts/help/__makeinfo__.m b/scripts/help/__makeinfo__.m --- a/scripts/help/__makeinfo__.m +++ b/scripts/help/__makeinfo__.m @@ -17,28 +17,50 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}) -## @deftypefnx {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}, @var{output_type}) +## @deftypefn {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}, @var{output_type}) +## @deftypefnx {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}, @var{output_type}, @var{see_also}) ## Undocumented internal function. ## @end deftypefn ## Run @code{makeinfo} on a given text. ## ## The string @var{text} is run through the @code{__makeinfo__} program -## to generate output in various formats. This string must contain valid +## to generate output in various formats. This string must contain valid ## Texinfo formatted text. ## -## The @var{output_type} selects the format of the output. This can be either -## @qcode{"html"}, @qcode{"texinfo"}, or @qcode{"plain text"}. By default this -## is @qcode{"plain text"}. +## The @var{output_type} selects the format of the output. This can be either +## @t{"html"}, @t{"texinfo"}, or @t{"plain text"}. By default this is +## @t{"plain text"}. If @var{output_type} is @t{"texinfo"}, the @t{@@seealso} +## macro is expanded, but otherwise the text is unaltered. +## +## If the optional argument @var{see_also} is present, it is used to expand the +## Octave specific @t{@@seealso} macro. This argument must be a function handle, +## that accepts a cell array of strings as input argument (each elements of the +## array corresponds to the arguments to the @t{@@seealso} macro), and return +## the expanded string. If this argument is not given, the @t{@@seealso} macro +## will be expanded to the text +## +## @example +## See also: arg1, arg2, ... +## @end example +## +## @noindent +## for @t{"plain text"} output, and +## +## @example +## See also: @@ref@{arg1@}, @@ref@{arg2@}, ... +## @end example +## +## @noindent +## otherwise. ## ## The optional output argument @var{status} contains the exit status of the ## @code{makeinfo} program as returned by @code{system}. -function [retval, status] = __makeinfo__ (text, output_type = "plain text") +function [retval, status] = __makeinfo__ (text, output_type = "plain text", fsee_also) ## Check input - if (nargin < 1 || nargin > 2) + if (nargin < 1 || nargin > 3) print_usage (); endif @@ -47,7 +69,24 @@ endif if (! ischar (output_type)) - error ("__makeinfo__: OUTPUT_TYPE must be a string"); + error ("__makeinfo__: second input argument must be a string"); + endif + + ## NOTE: The 3rd argument is used by Octave-Forge function + ## generate_package_html, not by core Octave. This functionality + ## can only be removed when that function has been updated. + if (nargin < 3) + if (strcmpi (output_type, "plain text")) + fsee_also = @(T) strcat ... + ("\nSee also:", sprintf (" %s,", T{:})(1:end-1), "\n"); + else + fsee_also = @(T) strcat ... + ("\nSee also:", sprintf (" @ref{%s},", T{:})(1:end-1), "\n"); + endif + endif + + if (! isa (fsee_also, "function_handle")) + error ("__makeinfo__: third input argument must be a function handle"); endif ## Formatting in m-files has an extra space at the beginning of every line. @@ -90,10 +129,10 @@ ## Take action depending on output type switch (lower (output_type)) case "plain text" - cmd = sprintf ("%s --no-headers --no-warn --no-validate --force %s", + cmd = sprintf ("%s --no-headers --no-warn --force --no-validate %s", makeinfo_program (), name); case "html" - cmd = sprintf ("%s --html --no-headers --no-warn --no-validate --force %s", + cmd = sprintf ("%s --no-headers --html --no-warn --no-validate --force %s", makeinfo_program (), name); otherwise error ("__makeinfo__: unsupported output type: '%s'", output_type); diff --git a/scripts/plot/axis.m b/scripts/plot/axis.m --- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -333,15 +333,15 @@ if (strcmp (scale, "log")) tmp = data; data = cellfun (@(x) x(x>0), tmp, "uniformoutput", false); - n = cellfun (@isempty, data); + n = cellfun ("isempty", data); data(n) = cellfun (@(x) x(x<0), tmp(n), "uniformoutput", false); endif data = cellfun (@(x) x(isfinite (x)), data, "uniformoutput", false); data = data(! cellfun ("isempty", data)); if (! isempty (data)) - lims_min = min ([data{:}](:)); - lims_max = max ([data{:}](:)); - lims = [lims_min, lims_max]; + ## Change data from cell array of various sizes to a single column vector + data = cat (1, cellindexmat (data, ":"){:}); + lims = [min(data), max(data)]; else lims = [0, 1]; endif @@ -610,3 +610,16 @@ %! close (hf); %! end_unwind_protect +## Test 'axis tight' with differently oriented, differently numbered data vecs +## Bug #40036. +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! Z = peaks (linspace (-3, 3, 49), linspace (-2, 2, 29)); +%! surf (Z); +%! axis tight; +%! assert (axis (), [1 49 1 29 min(Z(:)) max(Z(:))]); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + diff --git a/scripts/plot/subplot.m b/scripts/plot/subplot.m --- a/scripts/plot/subplot.m +++ b/scripts/plot/subplot.m @@ -19,21 +19,23 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} subplot (@var{rows}, @var{cols}, @var{index}) ## @deftypefnx {Function File} {} subplot (@var{rcn}) +## @deftypefnx {Function File} {} subplot (@var{hax}) ## @deftypefnx {Function File} {} subplot (@dots{}, "align") -## @deftypefnx {Function File} {@var{hax} =} subplot (@dots{}) +## @deftypefnx {Function File} {} subplot (@dots{}, "replace") +## @deftypefnx {Function File} {} subplot (@dots{}, "position", @var{pos}) +## @deftypefnx {Function File} {} subplot (@dots{}, @var{prop}, @var{val}, @dots{}) ## @deftypefnx {Function File} {@var{hax} =} subplot (@dots{}) ## Set up a plot grid with @var{rows} by @var{cols} subwindows and set the -## current axes for plotting to the location given by @var{index}. +## current axes for plotting (@code{gca}) to the location given by @var{index}. ## ## If only one numeric argument is supplied, then it must be a three digit -## value specifying the location in digits 1 (rows) and 2 (columns) and the -## plot index in digit 3. +## value specifying the the number of rows in in digit 1, the number of +## columns in digit 2, and the plot index in digit 3. ## -## The plot index runs row-wise. First all the columns in a row are numbered +## The plot index runs row-wise; First, all columns in a row are numbered ## and then the next row is filled. ## -## For example, a plot with 2 by 3 grid will have plot indices running as -## follows: +## For example, a plot with 2x3 grid will have plot indices running as follows: ## @tex ## \vskip 10pt ## \hfil\vbox{\offinterlineskip\hrule @@ -58,18 +60,33 @@ ## @end ifnottex ## ## @var{index} may also be a vector. In this case, the new axis will enclose -## the grid locations specified. The first demo illustrates an example: +## the grid locations specified. The first demo illustrates this: ## ## @example ## demo ("subplot", 1) ## @end example ## +## The index of the subplot to make active may also be specified by its axes +## handle, @var{hax}, returned from a previous @code{subplot} command. +## ## If the option @qcode{"align"} is given then the plot boxes of the subwindows ## will align, but this may leave no room for axis tick marks or labels. ## +## If the option @qcode{"replace"} is given then the subplot axis will be +## reset, rather than just switching the current axis for plotting to the +## requested subplot. +## +## The @qcode{"position"} property can be used to exactly position the subplot +## axes within the current figure. The option @var{pos} is a 4-element vector +## [x, y, width, height] that determines the location and size of the axes. +## The values in @var{pos} are normalized in the range [0,1]. +## +## Any property/value pairs are passed directly to the underlying axes object. +## ## If the output @var{hax} is requested, subplot returns the axis handle for -## the subplot. This is useful for modifying the properties of a subplot. -## @seealso{axes, plot} +## the subplot. This is useful for modifying the properties of a subplot +## using @code{set}. +## @seealso{axes, plot, gca, set} ## @end deftypefn ## Author: Vinayak Dutt @@ -82,23 +99,24 @@ have_position = false; initial_args_decoded = false; - if (nargin > 2) + if (nargin >= 3) ## R, C, N? arg1 = varargin{1}; arg2 = varargin{2}; arg3 = varargin{3}; - if (isnumeric (arg1) && isscalar (arg1) && isnumeric (arg2) - && isscalar (arg2) && isnumeric (arg3)) + if ( isnumeric (arg1) && isscalar (arg1) + && isnumeric (arg2) && isscalar (arg2) + && isnumeric (arg3)) rows = arg1; cols = arg2; index = arg3; - varargin(1:3)= []; + varargin(1:3) = []; initial_args_decoded = true; endif endif if (! initial_args_decoded && nargin > 1) - ## check for 'position', pos, ... + ## check for "position", pos, ... if (strcmpi (varargin{1}, "position")) arg = varargin{2}; if (isnumeric (arg) && numel (arg) == 4) @@ -107,7 +125,7 @@ have_position = true; initial_args_decoded = true; else - error ("expecting position to be a 4-element numeric array"); + error ("subplot: POSITION must be a 4-element numeric array"); endif endif endif @@ -144,34 +162,32 @@ index = round (index); if (any (index < 1) || any (index > rows*cols)) - error ("subplot: INDEX value must be greater than 1 and less than ROWS*COLS"); + error ("subplot: INDEX value must be >= 1 and <= ROWS*COLS"); endif - if (cols < 1 || rows < 1 || index < 1) - error ("subplot: COLS, ROWS, and INDEX must be be positive"); + if (rows < 1 || cols < 1 || index < 1) + error ("subplot: ROWS, COLS, and INDEX must be be positive"); endif endif - nargs = numel (varargin); - while (nargs > 0) - arg = varargin{1}; - if (strcmpi (arg, "align")) - align_axes = true; - elseif (strcmpi (arg, "replace")) - replace_axes = true; - else - break; - endif - varargin(1) = []; - nargs--; - endwhile + ## Process "align" and "replace" options + idx = strcmpi (varargin, "align"); + if (any (idx)) + align_axes = true; + varargin(idx) = []; + endif + + idx = strcmpi (varargin, "replace"); + if (any (idx)) + replace_axes = true; + varargin(idx) = []; + endif axesunits = get (0, "defaultaxesunits"); cf = gcf (); figureunits = get (cf, "units"); unwind_protect - units = "normalized"; - set (0, "defaultaxesunits", units); + set (0, "defaultaxesunits", "normalized"); set (cf, "units", "pixels"); ## FIXME: At the moment we force gnuplot to use the aligned mode @@ -199,7 +215,7 @@ found = false; kids = get (cf, "children"); - for child = reshape (kids, 1, numel (kids)) + for child = kids(:)' ## Check whether this child is still valid; this might not be the ## case anymore due to the deletion of previous children (due to ## "deletefcn" callback or for legends/colorbars that are deleted @@ -209,23 +225,20 @@ endif if (strcmp (get (child, "type"), "axes")) ## Skip legend and colorbar objects. - if (strcmp (get (child, "tag"), "legend") - || strcmp (get (child, "tag"), "colorbar")) + if (any (strcmp (get (child, "tag"), {"legend", "colorbar"}))) continue; endif - if (align_axes) - objpos = get (child, "position"); - else - objpos = get (child, "outerposition"); - endif - if (all (abs (objpos - pos) < eps) && ! replace_axes) - ## If the new axes are in exactly the same position as an - ## existing axes object, use the existing axes. + objpos = get (child, "outerposition"); + if (all (abs (objpos - outerpos) < eps) && ! replace_axes) + ## If the new axes are in exactly the same position + ## as an existing axes object, use the existing axes. found = true; hsubplot = child; else - ## If the new axes overlap an old axes object, delete the old - ## axes. + ## If the new axes overlap an old axes object, delete the old axes. + if (align_axes) + objpos = get (child, "position"); + endif x0 = pos(1); x1 = x0 + pos(3); y0 = pos(2); @@ -242,6 +255,7 @@ endfor if (found) + ## Switch to existing subplot set (cf, "currentaxes", hsubplot); else hsubplot = axes ("box", "off", @@ -280,19 +294,13 @@ return; endif - if (strcmp (position_property, "outerposition") - || strcmp (position_property, "outerpositiontight")) + if (strcmp (position_property, "outerposition")) margins.left = 0.05; margins.bottom = 0.05; margins.right = 0.05; margins.top = 0.05; - if (strcmp (position_property, "outerpositiontight")) - margins.column = 0.; - margins.row = 0.; - else - margins.column = 0.04 / cols; - margins.row = 0.04 / rows; - endif + margins.column = 0.04 / cols; + margins.row = 0.04 / rows; width = 1 - margins.left - margins.right - (cols-1)*margins.column; width = width / cols; height = 1 - margins.top - margins.bottom - (rows-1)*margins.row; @@ -326,7 +334,7 @@ xi = index(:) - yi*cols - 1; yi = (rows - 1) - yi; - ## Lower left corner of the subplot, i.e. position(1:2) + ## Lower left corner of the subplot, i.e., position(1:2) x0 = xi .* (width + margins.column) + margins.left; y0 = yi .* (height + margins.row) + margins.bottom; @@ -345,28 +353,30 @@ endfunction function subplot_align (h, varargin) - persistent updating = false + persistent updating = false; + if (! updating) unwind_protect updating = true; hfig = ancestor (h, "figure"); - hsubplots = findall (hfig, 'type', 'axes', 'subplot_align', 'off'); + hsubplots = findall (hfig, "type", "axes", "subplot_align", "off"); if (! isempty (hsubplots)) - tightinset = get (hsubplots, 'tightinset'); + tightinset = get (hsubplots, "tightinset"); if (iscell (tightinset)) tightinset = max (cell2mat (tightinset)); endif - looseinset = get (hsubplots, 'looseinset'); + looseinset = get (hsubplots, "looseinset"); if (iscell (looseinset)) looseinset = max (cell2mat (looseinset)); endif looseinset = max (tightinset, looseinset); - set (hsubplots, 'looseinset', looseinset); + set (hsubplots, "looseinset", looseinset); endif unwind_protect_cleanup updating = false; end_unwind_protect endif + endfunction diff --git a/scripts/sparse/bicgstab.m b/scripts/sparse/bicgstab.m --- a/scripts/sparse/bicgstab.m +++ b/scripts/sparse/bicgstab.m @@ -145,7 +145,7 @@ flag = 1; for iter = 1:maxit - rho_1 = res' * rr; + rho_1 = rr' * res; if (iter == 1) p = res; @@ -163,7 +163,7 @@ shat = precon (s); t = Ax (shat); - omega = (t' * s) / (t' * t); + omega = (s' * t) / (t' * t); x = x + alpha * phat + omega * shat; res = s - omega * t; rho_2 = rho_1; @@ -248,3 +248,8 @@ %! [x, flag, relres, iter, resvec] = bicgstab (A, b, tol, [], diag (diag (A))); %! assert (x, ones (size (b)), 1e-7); +%!test +%! A = [1 + 1i, 1 + 1i; 2 - 1i, 2 + 1i]; +%! b = A * [1; 1]; +%! [x, flag, relres, iter, resvec] = bicgstab (A, b); +%! assert (x, [1; 1], 1e-6); diff --git a/test/io.tst b/test/io.tst --- a/test/io.tst +++ b/test/io.tst @@ -319,11 +319,11 @@ %!error sprintf (1) %!test -%! arch_list = {"native"; "ieee-le"; "ieee-be"; "vaxd"; "vaxg"; "cray"}; +%! arch_list = {"native"; "ieee-le"; "ieee-be"}; %! warning ("off", "Octave:fopen-mode"); %! status = 1; %! -%! for i = 1:6 +%! for i = 1:3 %! arch = arch_list{i}; %! for j = 1:4 %! if (j == 1) diff --git a/test/parser.tst b/test/parser.tst