Mercurial > octave-nkf
comparison libinterp/corefcn/file-io.cc @ 17787:175b392e91fe
Use GNU style coding conventions for code in libinterp/
* libinterp/corefcn/Cell.h, libinterp/corefcn/__contourc__.cc,
libinterp/corefcn/__dispatch__.cc, libinterp/corefcn/__lin_interpn__.cc,
libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc,
libinterp/corefcn/balance.cc, libinterp/corefcn/besselj.cc,
libinterp/corefcn/betainc.cc, libinterp/corefcn/bitfcns.cc,
libinterp/corefcn/bsxfun.cc, libinterp/corefcn/c-file-ptr-stream.cc,
libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/cellfun.cc,
libinterp/corefcn/colloc.cc, libinterp/corefcn/comment-list.h,
libinterp/corefcn/conv2.cc, libinterp/corefcn/daspk.cc,
libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc,
libinterp/corefcn/defaults.cc, libinterp/corefcn/defaults.in.h,
libinterp/corefcn/defun-int.h, libinterp/corefcn/defun.cc,
libinterp/corefcn/det.cc, libinterp/corefcn/dirfns.cc,
libinterp/corefcn/display.cc, libinterp/corefcn/dlmread.cc,
libinterp/corefcn/dot.cc, libinterp/corefcn/dynamic-ld.cc,
libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/eig.cc,
libinterp/corefcn/ellipj.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/error.h, libinterp/corefcn/event-queue.h,
libinterp/corefcn/fft.cc, libinterp/corefcn/fft2.cc, libinterp/corefcn/fftn.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/filter.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gammainc.cc,
libinterp/corefcn/gcd.cc, libinterp/corefcn/getgrent.cc,
libinterp/corefcn/getpwent.cc, libinterp/corefcn/getrusage.cc,
libinterp/corefcn/givens.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/gl2ps-renderer.h,
libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h,
libinterp/corefcn/gripes.cc, libinterp/corefcn/gripes.h,
libinterp/corefcn/help.cc, libinterp/corefcn/hess.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/input.h, libinterp/corefcn/inv.cc,
libinterp/corefcn/jit-ir.h, libinterp/corefcn/jit-typeinfo.cc,
libinterp/corefcn/jit-typeinfo.h, libinterp/corefcn/jit-util.h,
libinterp/corefcn/kron.cc, libinterp/corefcn/load-path.cc,
libinterp/corefcn/load-path.h, libinterp/corefcn/load-save.cc,
libinterp/corefcn/load-save.h, libinterp/corefcn/lookup.cc,
libinterp/corefcn/ls-ascii-helper.cc, libinterp/corefcn/ls-hdf5.cc,
libinterp/corefcn/ls-hdf5.h, libinterp/corefcn/ls-mat-ascii.cc,
libinterp/corefcn/ls-mat-ascii.h, libinterp/corefcn/ls-mat4.cc,
libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/ls-mat5.h,
libinterp/corefcn/ls-oct-ascii.cc, libinterp/corefcn/lsode.cc,
libinterp/corefcn/lu.cc, libinterp/corefcn/luinc.cc,
libinterp/corefcn/mappers.cc, libinterp/corefcn/matrix_type.cc,
libinterp/corefcn/max.cc, libinterp/corefcn/md5sum.cc,
libinterp/corefcn/mex.cc, libinterp/corefcn/mexproto.h,
libinterp/corefcn/mgorth.cc, libinterp/corefcn/mxarray.in.h,
libinterp/corefcn/nproc.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/oct-lvalue.h, libinterp/corefcn/oct-map.cc,
libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h,
libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-stdstrm.h,
libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h,
libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h,
libinterp/corefcn/pager.cc, libinterp/corefcn/pinv.cc,
libinterp/corefcn/pr-output.cc, libinterp/corefcn/procstream.h,
libinterp/corefcn/profiler.cc, libinterp/corefcn/pt-jit.cc,
libinterp/corefcn/pt-jit.h, libinterp/corefcn/quad.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/qz.cc,
libinterp/corefcn/rand.cc, libinterp/corefcn/rcond.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc,
libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sighandlers.h,
libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/sparse-xdiv.h,
libinterp/corefcn/sparse-xpow.cc, libinterp/corefcn/sparse.cc,
libinterp/corefcn/spparms.cc, libinterp/corefcn/sqrtm.cc,
libinterp/corefcn/str2double.cc, libinterp/corefcn/strfind.cc,
libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc,
libinterp/corefcn/svd.cc, libinterp/corefcn/syl.cc,
libinterp/corefcn/symtab.cc, libinterp/corefcn/symtab.h,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/sysdep.cc,
libinterp/corefcn/sysdep.h, libinterp/corefcn/time.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h,
libinterp/corefcn/tril.cc, libinterp/corefcn/txt-eng-ft.cc,
libinterp/corefcn/txt-eng-ft.h, libinterp/corefcn/txt-eng.h,
libinterp/corefcn/typecast.cc, libinterp/corefcn/urlwrite.cc,
libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc,
libinterp/corefcn/variables.h, libinterp/corefcn/xdiv.cc,
libinterp/corefcn/xdiv.h, libinterp/corefcn/xnorm.h, libinterp/corefcn/xpow.cc,
libinterp/corefcn/xpow.h, libinterp/corefcn/zfstream.cc,
libinterp/corefcn/zfstream.h, libinterp/dldfcn/__delaunayn__.cc,
libinterp/dldfcn/__dsearchn__.cc, libinterp/dldfcn/__eigs__.cc,
libinterp/dldfcn/__fltk_uigetfile__.cc, libinterp/dldfcn/__glpk__.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__init_gnuplot__.cc,
libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/__voronoi__.cc,
libinterp/dldfcn/amd.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/chol.cc,
libinterp/dldfcn/colamd.cc, libinterp/dldfcn/convhulln.cc,
libinterp/dldfcn/dmperm.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc,
libinterp/dldfcn/symbfact.cc, libinterp/dldfcn/symrcm.cc,
libinterp/dldfcn/tsearch.cc, libinterp/octave-value/ov-base-diag.cc,
libinterp/octave-value/ov-base-diag.h, libinterp/octave-value/ov-base-int.cc,
libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.h,
libinterp/octave-value/ov-base-scalar.cc,
libinterp/octave-value/ov-base-scalar.h,
libinterp/octave-value/ov-base-sparse.cc,
libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov-base.h, libinterp/octave-value/ov-bool-mat.cc,
libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.cc,
libinterp/octave-value/ov-bool-sparse.h, libinterp/octave-value/ov-bool.cc,
libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.cc,
libinterp/octave-value/ov-builtin.h, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.cc,
libinterp/octave-value/ov-ch-mat.h, libinterp/octave-value/ov-class.cc,
libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-colon.h,
libinterp/octave-value/ov-complex.cc, libinterp/octave-value/ov-complex.h,
libinterp/octave-value/ov-cx-diag.cc, libinterp/octave-value/ov-cx-diag.h,
libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-cx-mat.h,
libinterp/octave-value/ov-cx-sparse.cc, libinterp/octave-value/ov-cx-sparse.h,
libinterp/octave-value/ov-dld-fcn.h, libinterp/octave-value/ov-fcn-handle.cc,
libinterp/octave-value/ov-fcn-handle.h,
libinterp/octave-value/ov-fcn-inline.cc,
libinterp/octave-value/ov-fcn-inline.h, libinterp/octave-value/ov-fcn.h,
libinterp/octave-value/ov-float.cc, libinterp/octave-value/ov-float.h,
libinterp/octave-value/ov-flt-complex.cc,
libinterp/octave-value/ov-flt-complex.h,
libinterp/octave-value/ov-flt-cx-diag.cc,
libinterp/octave-value/ov-flt-cx-diag.h,
libinterp/octave-value/ov-flt-cx-mat.cc,
libinterp/octave-value/ov-flt-cx-mat.h,
libinterp/octave-value/ov-flt-re-diag.cc,
libinterp/octave-value/ov-flt-re-diag.h,
libinterp/octave-value/ov-flt-re-mat.cc,
libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int16.cc,
libinterp/octave-value/ov-int32.cc, libinterp/octave-value/ov-int64.cc,
libinterp/octave-value/ov-int8.cc, libinterp/octave-value/ov-intx.h,
libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-lazy-idx.h,
libinterp/octave-value/ov-mex-fcn.cc, libinterp/octave-value/ov-mex-fcn.h,
libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-null-mat.h,
libinterp/octave-value/ov-oncleanup.cc, libinterp/octave-value/ov-perm.cc,
libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range.cc,
libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-diag.cc,
libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.cc,
libinterp/octave-value/ov-re-mat.h, libinterp/octave-value/ov-re-sparse.cc,
libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.cc,
libinterp/octave-value/ov-scalar.h, libinterp/octave-value/ov-str-mat.cc,
libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-struct.h, libinterp/octave-value/ov-type-conv.h,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-typeinfo.h,
libinterp/octave-value/ov-uint16.cc, libinterp/octave-value/ov-uint32.cc,
libinterp/octave-value/ov-uint64.cc, libinterp/octave-value/ov-uint8.cc,
libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov-usr-fcn.h,
libinterp/octave-value/ov.cc, libinterp/octave-value/ov.h, libinterp/octave.cc,
libinterp/operators/op-b-bm.cc, libinterp/operators/op-b-sbm.cc,
libinterp/operators/op-bm-b.cc, libinterp/operators/op-bm-bm.cc,
libinterp/operators/op-cdm-cdm.cc, libinterp/operators/op-chm.cc,
libinterp/operators/op-class.cc, libinterp/operators/op-cm-cm.cc,
libinterp/operators/op-cm-cs.cc, libinterp/operators/op-cm-s.cc,
libinterp/operators/op-cm-scm.cc, libinterp/operators/op-cm-sm.cc,
libinterp/operators/op-cs-cm.cc, libinterp/operators/op-cs-cs.cc,
libinterp/operators/op-cs-scm.cc, libinterp/operators/op-cs-sm.cc,
libinterp/operators/op-dm-dm.cc, libinterp/operators/op-dm-scm.cc,
libinterp/operators/op-double-conv.cc, libinterp/operators/op-fcdm-fcdm.cc,
libinterp/operators/op-fcm-fcm.cc, libinterp/operators/op-fcm-fcs.cc,
libinterp/operators/op-fcm-fm.cc, libinterp/operators/op-fcm-fs.cc,
libinterp/operators/op-fcs-fcm.cc, libinterp/operators/op-fcs-fcs.cc,
libinterp/operators/op-fcs-fm.cc, libinterp/operators/op-fcs-fs.cc,
libinterp/operators/op-fdm-fdm.cc, libinterp/operators/op-float-conv.cc,
libinterp/operators/op-fm-fcm.cc, libinterp/operators/op-fm-fcs.cc,
libinterp/operators/op-fm-fm.cc, libinterp/operators/op-fm-fs.cc,
libinterp/operators/op-fs-fcm.cc, libinterp/operators/op-fs-fcs.cc,
libinterp/operators/op-fs-fm.cc, libinterp/operators/op-fs-fs.cc,
libinterp/operators/op-m-cm.cc, libinterp/operators/op-m-cs.cc,
libinterp/operators/op-m-m.cc, libinterp/operators/op-m-s.cc,
libinterp/operators/op-m-scm.cc, libinterp/operators/op-m-sm.cc,
libinterp/operators/op-pm-scm.cc, libinterp/operators/op-range.cc,
libinterp/operators/op-s-cm.cc, libinterp/operators/op-s-cs.cc,
libinterp/operators/op-s-scm.cc, libinterp/operators/op-sbm-b.cc,
libinterp/operators/op-sbm-bm.cc, libinterp/operators/op-sbm-sbm.cc,
libinterp/operators/op-scm-cm.cc, libinterp/operators/op-scm-cs.cc,
libinterp/operators/op-scm-m.cc, libinterp/operators/op-scm-s.cc,
libinterp/operators/op-scm-scm.cc, libinterp/operators/op-scm-sm.cc,
libinterp/operators/op-sm-cm.cc, libinterp/operators/op-sm-m.cc,
libinterp/operators/op-sm-s.cc, libinterp/operators/op-sm-scm.cc,
libinterp/operators/op-sm-sm.cc, libinterp/operators/op-str-m.cc,
libinterp/operators/op-str-s.cc, libinterp/operators/op-str-str.cc,
libinterp/operators/ops.h, libinterp/parse-tree/lex.h,
libinterp/parse-tree/parse.h, libinterp/parse-tree/pt-arg-list.cc,
libinterp/parse-tree/pt-arg-list.h, libinterp/parse-tree/pt-assign.cc,
libinterp/parse-tree/pt-assign.h, libinterp/parse-tree/pt-binop.cc,
libinterp/parse-tree/pt-binop.h, libinterp/parse-tree/pt-bp.h,
libinterp/parse-tree/pt-cbinop.cc, libinterp/parse-tree/pt-check.cc,
libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-colon.h,
libinterp/parse-tree/pt-const.cc, libinterp/parse-tree/pt-decl.cc,
libinterp/parse-tree/pt-decl.h, libinterp/parse-tree/pt-eval.cc,
libinterp/parse-tree/pt-except.h, libinterp/parse-tree/pt-exp.h,
libinterp/parse-tree/pt-fcn-handle.cc, libinterp/parse-tree/pt-id.cc,
libinterp/parse-tree/pt-id.h, libinterp/parse-tree/pt-idx.cc,
libinterp/parse-tree/pt-idx.h, libinterp/parse-tree/pt-loop.h,
libinterp/parse-tree/pt-mat.cc, libinterp/parse-tree/pt-misc.cc,
libinterp/parse-tree/pt-misc.h, libinterp/parse-tree/pt-pr-code.cc,
libinterp/parse-tree/pt-select.h, libinterp/parse-tree/pt-stmt.h,
libinterp/parse-tree/token.h, libinterp/version.cc:
Use GNU style coding conventions for code in libinterp/
author | Rik <rik@octave.org> |
---|---|
date | Mon, 28 Oct 2013 19:51:46 -0700 |
parents | d63878346099 |
children | 62f94ef938b4 |
comparison
equal
deleted
inserted
replaced
17786:34d9812a943b | 17787:175b392e91fe |
---|---|
107 octave_stream_list::clear (); | 107 octave_stream_list::clear (); |
108 } | 108 } |
109 | 109 |
110 // List of files to delete when we exit or crash. | 110 // List of files to delete when we exit or crash. |
111 // | 111 // |
112 // FIXME -- this should really be static, but that causes | 112 // FIXME: this should really be static, |
113 // problems on some systems. | 113 // but that causes problems on some systems. |
114 std::stack <std::string> tmp_files; | 114 std::stack <std::string> tmp_files; |
115 | 115 |
116 void | 116 void |
117 mark_for_deletion (const std::string& file) | 117 mark_for_deletion (const std::string& file) |
118 { | 118 { |
235 | 235 |
236 return retval; | 236 return retval; |
237 } | 237 } |
238 | 238 |
239 DEFUN (fclose, args, , | 239 DEFUN (fclose, args, , |
240 "-*- texinfo -*-\n\ | 240 "-*- texinfo -*-\n\ |
241 @deftypefn {Built-in Function} {} fclose (@var{fid})\n\ | 241 @deftypefn {Built-in Function} {} fclose (@var{fid})\n\ |
242 @deftypefnx {Built-in Function} {} fclose (\"all\")\n\ | 242 @deftypefnx {Built-in Function} {} fclose (\"all\")\n\ |
243 Close the specified file. If successful, @code{fclose} returns 0,\n\ | 243 Close the specified file. If successful, @code{fclose} returns 0,\n\ |
244 otherwise, it returns -1. The second form of the @code{fclose} call closes\n\ | 244 otherwise, it returns -1. The second form of the @code{fclose} call closes\n\ |
245 all open files except @code{stdout}, @code{stderr}, and @code{stdin}.\n\ | 245 all open files except @code{stdout}, @code{stderr}, and @code{stdin}.\n\ |
257 | 257 |
258 return retval; | 258 return retval; |
259 } | 259 } |
260 | 260 |
261 DEFUN (fclear, args, , | 261 DEFUN (fclear, args, , |
262 "-*- texinfo -*-\n\ | 262 "-*- texinfo -*-\n\ |
263 @deftypefn {Built-in Function} {} fclear (@var{fid})\n\ | 263 @deftypefn {Built-in Function} {} fclear (@var{fid})\n\ |
264 Clear the stream state for the specified file.\n\ | 264 Clear the stream state for the specified file.\n\ |
265 @seealso{fopen}\n\ | 265 @seealso{fopen}\n\ |
266 @end deftypefn") | 266 @end deftypefn") |
267 { | 267 { |
283 | 283 |
284 return retval; | 284 return retval; |
285 } | 285 } |
286 | 286 |
287 DEFUN (fflush, args, , | 287 DEFUN (fflush, args, , |
288 "-*- texinfo -*-\n\ | 288 "-*- texinfo -*-\n\ |
289 @deftypefn {Built-in Function} {} fflush (@var{fid})\n\ | 289 @deftypefn {Built-in Function} {} fflush (@var{fid})\n\ |
290 Flush output to @var{fid}. This is useful for ensuring that all\n\ | 290 Flush output to @var{fid}. This is useful for ensuring that all\n\ |
291 pending output makes it to the screen before some other event occurs.\n\ | 291 pending output makes it to the screen before some other event occurs.\n\ |
292 For example, it is always a good idea to flush the standard output\n\ | 292 For example, it is always a good idea to flush the standard output\n\ |
293 stream before calling @code{input}.\n\ | 293 stream before calling @code{input}.\n\ |
301 | 301 |
302 int nargin = args.length (); | 302 int nargin = args.length (); |
303 | 303 |
304 if (nargin == 1) | 304 if (nargin == 1) |
305 { | 305 { |
306 // FIXME -- any way to avoid special case for stdout? | 306 // FIXME: any way to avoid special case for stdout? |
307 | 307 |
308 int fid = octave_stream_list::get_file_number (args (0)); | 308 int fid = octave_stream_list::get_file_number (args (0)); |
309 | 309 |
310 if (fid == 1) | 310 if (fid == 1) |
311 { | 311 { |
326 | 326 |
327 return retval; | 327 return retval; |
328 } | 328 } |
329 | 329 |
330 DEFUN (fgetl, args, , | 330 DEFUN (fgetl, args, , |
331 "-*- texinfo -*-\n\ | 331 "-*- texinfo -*-\n\ |
332 @deftypefn {Built-in Function} {@var{str} =} fgetl (@var{fid})\n\ | 332 @deftypefn {Built-in Function} {@var{str} =} fgetl (@var{fid})\n\ |
333 @deftypefnx {Built-in Function} {@var{str} =} fgetl (@var{fid}, @var{len})\n\ | 333 @deftypefnx {Built-in Function} {@var{str} =} fgetl (@var{fid}, @var{len})\n\ |
334 Read characters from a file, stopping after a newline, or EOF,\n\ | 334 Read characters from a file, stopping after a newline, or EOF,\n\ |
335 or @var{len} characters have been read. The characters read, excluding\n\ | 335 or @var{len} characters have been read. The characters read, excluding\n\ |
336 the possible trailing newline, are returned as a string.\n\ | 336 the possible trailing newline, are returned as a string.\n\ |
377 | 377 |
378 return retval; | 378 return retval; |
379 } | 379 } |
380 | 380 |
381 DEFUN (fgets, args, , | 381 DEFUN (fgets, args, , |
382 "-*- texinfo -*-\n\ | 382 "-*- texinfo -*-\n\ |
383 @deftypefn {Built-in Function} {@var{str} =} fgets (@var{fid})\n\ | 383 @deftypefn {Built-in Function} {@var{str} =} fgets (@var{fid})\n\ |
384 @deftypefnx {Built-in Function} {@var{str} =} fgets (@var{fid}, @var{len})\n\ | 384 @deftypefnx {Built-in Function} {@var{str} =} fgets (@var{fid}, @var{len})\n\ |
385 Read characters from a file, stopping after a newline, or EOF,\n\ | 385 Read characters from a file, stopping after a newline, or EOF,\n\ |
386 or @var{len} characters have been read. The characters read, including\n\ | 386 or @var{len} characters have been read. The characters read, including\n\ |
387 the possible trailing newline, are returned as a string.\n\ | 387 the possible trailing newline, are returned as a string.\n\ |
428 | 428 |
429 return retval; | 429 return retval; |
430 } | 430 } |
431 | 431 |
432 DEFUN (fskipl, args, , | 432 DEFUN (fskipl, args, , |
433 "-*- texinfo -*-\n\ | 433 "-*- texinfo -*-\n\ |
434 @deftypefn {Built-in Function} {@var{nlines} =} fskipl (@var{fid})\n\ | 434 @deftypefn {Built-in Function} {@var{nlines} =} fskipl (@var{fid})\n\ |
435 @deftypefnx {Built-in Function} {@var{nlines} =} fskipl (@var{fid}, @var{count})\n\ | 435 @deftypefnx {Built-in Function} {@var{nlines} =} fskipl (@var{fid}, @var{count})\n\ |
436 @deftypefnx {Built-in Function} {@var{nlines} =} fskipl (@var{fid}, Inf)\n\ | 436 @deftypefnx {Built-in Function} {@var{nlines} =} fskipl (@var{fid}, Inf)\n\ |
437 Read and skip @var{count} lines from the file descriptor @var{fid}.\n\ | 437 Read and skip @var{count} lines from the file descriptor @var{fid}.\n\ |
438 @code{fskipl} discards characters until an end-of-line is encountered exactly\n\ | 438 @code{fskipl} discards characters until an end-of-line is encountered exactly\n\ |
538 else | 538 else |
539 #endif | 539 #endif |
540 { | 540 { |
541 FILE *fptr = gnulib::fopen (fname.c_str (), mode.c_str ()); | 541 FILE *fptr = gnulib::fopen (fname.c_str (), mode.c_str ()); |
542 | 542 |
543 retval = octave_stdiostream::create (fname, fptr, md, flt_fmt); | 543 retval = octave_stdiostream::create (fname, fptr, md, |
544 flt_fmt); | |
544 | 545 |
545 if (! fptr) | 546 if (! fptr) |
546 retval.error (gnulib::strerror (errno)); | 547 retval.error (gnulib::strerror (errno)); |
547 } | 548 } |
548 | 549 |
584 | 585 |
585 return retval; | 586 return retval; |
586 } | 587 } |
587 | 588 |
588 DEFUN (fopen, args, nargout, | 589 DEFUN (fopen, args, nargout, |
589 "-*- texinfo -*-\n\ | 590 "-*- texinfo -*-\n\ |
590 @deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} fopen (@var{name}, @var{mode}, @var{arch})\n\ | 591 @deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} fopen (@var{name}, @var{mode}, @var{arch})\n\ |
591 @deftypefnx {Built-in Function} {@var{fid_list} =} fopen (\"all\")\n\ | 592 @deftypefnx {Built-in Function} {@var{fid_list} =} fopen (\"all\")\n\ |
592 @deftypefnx {Built-in Function} {[@var{file}, @var{mode}, @var{arch}] =} fopen (@var{fid})\n\ | 593 @deftypefnx {Built-in Function} {[@var{file}, @var{mode}, @var{arch}] =} fopen (@var{fid})\n\ |
593 The first form of the @code{fopen} function opens the named file with\n\ | 594 The first form of the @code{fopen} function opens the named file with\n\ |
594 the specified mode (read-write, read-only, etc.) and architecture\n\ | 595 the specified mode (read-write, read-only, etc.) and architecture\n\ |
712 } | 713 } |
713 | 714 |
714 if (nargin > 0 && nargin < 4) | 715 if (nargin > 0 && nargin < 4) |
715 { | 716 { |
716 octave_value mode = (nargin == 2 || nargin == 3) | 717 octave_value mode = (nargin == 2 || nargin == 3) |
717 ? args(1) : octave_value ("r"); | 718 ? args(1) : octave_value ("r"); |
718 | 719 |
719 octave_value arch = (nargin == 3) | 720 octave_value arch = (nargin == 3) |
720 ? args(2) : octave_value ("native"); | 721 ? args(2) : octave_value ("native"); |
721 | 722 |
722 int fid = -1; | 723 int fid = -1; |
723 | 724 |
724 octave_stream os = do_stream_open (args(0), mode, arch, "fopen", fid); | 725 octave_stream os = do_stream_open (args(0), mode, arch, "fopen", fid); |
725 | 726 |
741 | 742 |
742 return retval; | 743 return retval; |
743 } | 744 } |
744 | 745 |
745 DEFUN (freport, args, , | 746 DEFUN (freport, args, , |
746 "-*- texinfo -*-\n\ | 747 "-*- texinfo -*-\n\ |
747 @deftypefn {Built-in Function} {} freport ()\n\ | 748 @deftypefn {Built-in Function} {} freport ()\n\ |
748 Print a list of which files have been opened, and whether they are open\n\ | 749 Print a list of which files have been opened, and whether they are open\n\ |
749 for reading, writing, or both. For example:\n\ | 750 for reading, writing, or both. For example:\n\ |
750 \n\ | 751 \n\ |
751 @example\n\ | 752 @example\n\ |
774 | 775 |
775 return retval; | 776 return retval; |
776 } | 777 } |
777 | 778 |
778 DEFUN (frewind, args, nargout, | 779 DEFUN (frewind, args, nargout, |
779 "-*- texinfo -*-\n\ | 780 "-*- texinfo -*-\n\ |
780 @deftypefn {Built-in Function} {} frewind (@var{fid})\n\ | 781 @deftypefn {Built-in Function} {} frewind (@var{fid})\n\ |
781 Move the file pointer to the beginning of the file @var{fid}, returning\n\ | 782 Move the file pointer to the beginning of the file @var{fid}, returning\n\ |
782 0 for success, and -1 if an error was encountered. It is equivalent to\n\ | 783 0 for success, and -1 if an error was encountered. It is equivalent to\n\ |
783 @code{fseek (@var{fid}, 0, SEEK_SET)}.\n\ | 784 @code{fseek (@var{fid}, 0, SEEK_SET)}.\n\ |
784 @seealso{fseek, ftell, fopen}\n\ | 785 @seealso{fseek, ftell, fopen}\n\ |
805 | 806 |
806 return retval; | 807 return retval; |
807 } | 808 } |
808 | 809 |
809 DEFUN (fseek, args, , | 810 DEFUN (fseek, args, , |
810 "-*- texinfo -*-\n\ | 811 "-*- texinfo -*-\n\ |
811 @deftypefn {Built-in Function} {} fseek (@var{fid}, @var{offset})\n\ | 812 @deftypefn {Built-in Function} {} fseek (@var{fid}, @var{offset})\n\ |
812 @deftypefnx {Built-in Function} {} fseek (@var{fid}, @var{offset}, @var{origin})\n\ | 813 @deftypefnx {Built-in Function} {} fseek (@var{fid}, @var{offset}, @var{origin})\n\ |
813 @deftypefnx {Built-in Function} {@var{status} =} fseek (@dots{})\n\ | 814 @deftypefnx {Built-in Function} {@var{status} =} fseek (@dots{})\n\ |
814 Set the file pointer to any location within the file @var{fid}.\n\ | 815 Set the file pointer to any location within the file @var{fid}.\n\ |
815 \n\ | 816 \n\ |
834 octave_stream os = octave_stream_list::lookup (args(0), "fseek"); | 835 octave_stream os = octave_stream_list::lookup (args(0), "fseek"); |
835 | 836 |
836 if (! error_state) | 837 if (! error_state) |
837 { | 838 { |
838 octave_value origin_arg = (nargin == 3) | 839 octave_value origin_arg = (nargin == 3) |
839 ? args(2) : octave_value (-1.0); | 840 ? args(2) : octave_value (-1.0); |
840 | 841 |
841 retval = os.seek (args(1), origin_arg); | 842 retval = os.seek (args(1), origin_arg); |
842 } | 843 } |
843 } | 844 } |
844 else | 845 else |
846 | 847 |
847 return retval; | 848 return retval; |
848 } | 849 } |
849 | 850 |
850 DEFUN (ftell, args, , | 851 DEFUN (ftell, args, , |
851 "-*- texinfo -*-\n\ | 852 "-*- texinfo -*-\n\ |
852 @deftypefn {Built-in Function} {} ftell (@var{fid})\n\ | 853 @deftypefn {Built-in Function} {} ftell (@var{fid})\n\ |
853 Return the position of the file pointer as the number of characters\n\ | 854 Return the position of the file pointer as the number of characters\n\ |
854 from the beginning of the file @var{fid}.\n\ | 855 from the beginning of the file @var{fid}.\n\ |
855 @seealso{fseek, feof, fopen}\n\ | 856 @seealso{fseek, feof, fopen}\n\ |
856 @end deftypefn") | 857 @end deftypefn") |
871 | 872 |
872 return retval; | 873 return retval; |
873 } | 874 } |
874 | 875 |
875 DEFUN (fprintf, args, nargout, | 876 DEFUN (fprintf, args, nargout, |
876 "-*- texinfo -*-\n\ | 877 "-*- texinfo -*-\n\ |
877 @deftypefn {Built-in Function} {} fprintf (@var{fid}, @var{template}, @dots{})\n\ | 878 @deftypefn {Built-in Function} {} fprintf (@var{fid}, @var{template}, @dots{})\n\ |
878 This function is just like @code{printf}, except that the output is\n\ | 879 This function is just like @code{printf}, except that the output is\n\ |
879 written to the stream @var{fid} instead of @code{stdout}.\n\ | 880 written to the stream @var{fid} instead of @code{stdout}.\n\ |
880 If @var{fid} is omitted, the output is written to @code{stdout}.\n\ | 881 If @var{fid} is omitted, the output is written to @code{stdout}.\n\ |
881 @seealso{fputs, fdisp, fwrite, fscanf, printf, sprintf, fopen}\n\ | 882 @seealso{fputs, fdisp, fwrite, fscanf, printf, sprintf, fopen}\n\ |
932 | 933 |
933 return retval; | 934 return retval; |
934 } | 935 } |
935 | 936 |
936 DEFUN (printf, args, nargout, | 937 DEFUN (printf, args, nargout, |
937 "-*- texinfo -*-\n\ | 938 "-*- texinfo -*-\n\ |
938 @deftypefn {Built-in Function} {} printf (@var{template}, @dots{})\n\ | 939 @deftypefn {Built-in Function} {} printf (@var{template}, @dots{})\n\ |
939 Print optional arguments under the control of the template string\n\ | 940 Print optional arguments under the control of the template string\n\ |
940 @var{template} to the stream @code{stdout} and return the number of\n\ | 941 @var{template} to the stream @code{stdout} and return the number of\n\ |
941 characters printed.\n\ | 942 characters printed.\n\ |
942 @ifclear OCTAVE_MANUAL\n\ | 943 @ifclear OCTAVE_MANUAL\n\ |
982 | 983 |
983 return retval; | 984 return retval; |
984 } | 985 } |
985 | 986 |
986 DEFUN (fputs, args, , | 987 DEFUN (fputs, args, , |
987 "-*- texinfo -*-\n\ | 988 "-*- texinfo -*-\n\ |
988 @deftypefn {Built-in Function} {} fputs (@var{fid}, @var{string})\n\ | 989 @deftypefn {Built-in Function} {} fputs (@var{fid}, @var{string})\n\ |
989 Write a string to a file with no formatting.\n\ | 990 Write a string to a file with no formatting.\n\ |
990 \n\ | 991 \n\ |
991 Return a non-negative number on success and EOF on error.\n\ | 992 Return a non-negative number on success and EOF on error.\n\ |
992 @seealso{fdisp, fprintf, fwrite, fopen}\n\ | 993 @seealso{fdisp, fprintf, fwrite, fopen}\n\ |
1010 | 1011 |
1011 return retval; | 1012 return retval; |
1012 } | 1013 } |
1013 | 1014 |
1014 DEFUN (puts, args, , | 1015 DEFUN (puts, args, , |
1015 "-*- texinfo -*-\n\ | 1016 "-*- texinfo -*-\n\ |
1016 @deftypefn {Built-in Function} {} puts (@var{string})\n\ | 1017 @deftypefn {Built-in Function} {} puts (@var{string})\n\ |
1017 Write a string to the standard output with no formatting.\n\ | 1018 Write a string to the standard output with no formatting.\n\ |
1018 \n\ | 1019 \n\ |
1019 Return a non-negative number on success and EOF on error.\n\ | 1020 Return a non-negative number on success and EOF on error.\n\ |
1020 @seealso{fputs, disp}\n\ | 1021 @seealso{fputs, disp}\n\ |
1031 | 1032 |
1032 return retval; | 1033 return retval; |
1033 } | 1034 } |
1034 | 1035 |
1035 DEFUN (sprintf, args, , | 1036 DEFUN (sprintf, args, , |
1036 "-*- texinfo -*-\n\ | 1037 "-*- texinfo -*-\n\ |
1037 @deftypefn {Built-in Function} {} sprintf (@var{template}, @dots{})\n\ | 1038 @deftypefn {Built-in Function} {} sprintf (@var{template}, @dots{})\n\ |
1038 This is like @code{printf}, except that the output is returned as a\n\ | 1039 This is like @code{printf}, except that the output is returned as a\n\ |
1039 string. Unlike the C library function, which requires you to provide a\n\ | 1040 string. Unlike the C library function, which requires you to provide a\n\ |
1040 suitably sized string as an argument, Octave's @code{sprintf} function\n\ | 1041 suitably sized string as an argument, Octave's @code{sprintf} function\n\ |
1041 returns the string, automatically sized to hold all of the items\n\ | 1042 returns the string, automatically sized to hold all of the items\n\ |
1091 | 1092 |
1092 return retval; | 1093 return retval; |
1093 } | 1094 } |
1094 | 1095 |
1095 DEFUN (fscanf, args, , | 1096 DEFUN (fscanf, args, , |
1096 "-*- texinfo -*-\n\ | 1097 "-*- texinfo -*-\n\ |
1097 @deftypefn {Built-in Function} {[@var{val}, @var{count}, @var{errmsg}] =} fscanf (@var{fid}, @var{template}, @var{size})\n\ | 1098 @deftypefn {Built-in Function} {[@var{val}, @var{count}, @var{errmsg}] =} fscanf (@var{fid}, @var{template}, @var{size})\n\ |
1098 @deftypefnx {Built-in Function} {[@var{v1}, @var{v2}, @dots{}, @var{count}, @var{errmsg}] =} fscanf (@var{fid}, @var{template}, \"C\")\n\ | 1099 @deftypefnx {Built-in Function} {[@var{v1}, @var{v2}, @dots{}, @var{count}, @var{errmsg}] =} fscanf (@var{fid}, @var{template}, \"C\")\n\ |
1099 In the first form, read from @var{fid} according to @var{template},\n\ | 1100 In the first form, read from @var{fid} according to @var{template},\n\ |
1100 returning the result in the matrix @var{val}.\n\ | 1101 returning the result in the matrix @var{val}.\n\ |
1101 \n\ | 1102 \n\ |
1176 if (args(1).is_string ()) | 1177 if (args(1).is_string ()) |
1177 { | 1178 { |
1178 octave_idx_type count = 0; | 1179 octave_idx_type count = 0; |
1179 | 1180 |
1180 Array<double> size = (nargin == 3) | 1181 Array<double> size = (nargin == 3) |
1181 ? args(2).vector_value () | 1182 ? args(2).vector_value () |
1182 : Array<double> (dim_vector (1, 1), lo_ieee_inf_value ()); | 1183 : Array<double> (dim_vector (1, 1), |
1184 lo_ieee_inf_value ()); | |
1183 | 1185 |
1184 if (! error_state) | 1186 if (! error_state) |
1185 { | 1187 { |
1186 octave_value tmp = os.scanf (args(1), size, count, who); | 1188 octave_value tmp = os.scanf (args(1), size, count, who); |
1187 | 1189 |
1220 | 1222 |
1221 return retval; | 1223 return retval; |
1222 } | 1224 } |
1223 | 1225 |
1224 DEFUN (sscanf, args, , | 1226 DEFUN (sscanf, args, , |
1225 "-*- texinfo -*-\n\ | 1227 "-*- texinfo -*-\n\ |
1226 @deftypefn {Built-in Function} {[@var{val}, @var{count}, @var{errmsg}, @var{pos}] =} sscanf (@var{string}, @var{template}, @var{size})\n\ | 1228 @deftypefn {Built-in Function} {[@var{val}, @var{count}, @var{errmsg}, @var{pos}] =} sscanf (@var{string}, @var{template}, @var{size})\n\ |
1227 @deftypefnx {Built-in Function} {[@var{v1}, @var{v2}, @dots{}, @var{count}, @var{errmsg}] =} sscanf (@var{string}, @var{template}, \"C\")\n\ | 1229 @deftypefnx {Built-in Function} {[@var{v1}, @var{v2}, @dots{}, @var{count}, @var{errmsg}] =} sscanf (@var{string}, @var{template}, \"C\")\n\ |
1228 This is like @code{fscanf}, except that the characters are taken from the\n\ | 1230 This is like @code{fscanf}, except that the characters are taken from the\n\ |
1229 string @var{string} instead of from a stream. Reaching the end of the\n\ | 1231 string @var{string} instead of from a stream. Reaching the end of the\n\ |
1230 string is treated as an end-of-file condition. In addition to the values\n\ | 1232 string is treated as an end-of-file condition. In addition to the values\n\ |
1281 if (args(1).is_string ()) | 1283 if (args(1).is_string ()) |
1282 { | 1284 { |
1283 octave_idx_type count = 0; | 1285 octave_idx_type count = 0; |
1284 | 1286 |
1285 Array<double> size = (nargin == 3) | 1287 Array<double> size = (nargin == 3) |
1286 ? args(2).vector_value () | 1288 ? args(2).vector_value () |
1287 : Array<double> (dim_vector (1, 1), | 1289 : Array<double> (dim_vector (1, 1), |
1288 lo_ieee_inf_value ()); | 1290 lo_ieee_inf_value ()); |
1289 | 1291 |
1290 octave_value tmp = os.scanf (args(1), size, count, who); | 1292 octave_value tmp = os.scanf (args(1), size, count, who); |
1291 | 1293 |
1292 if (! error_state) | 1294 if (! error_state) |
1293 { | 1295 { |
1294 // FIXME -- is this the right thing to do? | 1296 // FIXME: is this the right thing to do? |
1295 // Extract error message first, because getting | 1297 // Extract error message first, because getting |
1296 // position will clear it. | 1298 // position will clear it. |
1297 std::string errmsg = os.error (); | 1299 std::string errmsg = os.error (); |
1298 | 1300 |
1299 retval(3) | 1301 retval(3) |
1302 retval(1) = count; | 1304 retval(1) = count; |
1303 retval(0) = tmp; | 1305 retval(0) = tmp; |
1304 } | 1306 } |
1305 } | 1307 } |
1306 else | 1308 else |
1307 ::error ("%s: format TEMPLATE must be a string", who.c_str ()); | 1309 ::error ("%s: format TEMPLATE must be a string", |
1310 who.c_str ()); | |
1308 } | 1311 } |
1309 else | 1312 else |
1310 ::error ("%s: unable to create temporary input buffer", | 1313 ::error ("%s: unable to create temporary input buffer", |
1311 who.c_str ()); | 1314 who.c_str ()); |
1312 } | 1315 } |
1317 | 1320 |
1318 return retval; | 1321 return retval; |
1319 } | 1322 } |
1320 | 1323 |
1321 DEFUN (scanf, args, nargout, | 1324 DEFUN (scanf, args, nargout, |
1322 "-*- texinfo -*-\n\ | 1325 "-*- texinfo -*-\n\ |
1323 @deftypefn {Built-in Function} {[@var{val}, @var{count}, @var{errmsg}] =} scanf (@var{template}, @var{size})\n\ | 1326 @deftypefn {Built-in Function} {[@var{val}, @var{count}, @var{errmsg}] =} scanf (@var{template}, @var{size})\n\ |
1324 @deftypefnx {Built-in Function} {[@var{v1}, @var{v2}, @dots{}, @var{count}, @var{errmsg}]] =} scanf (@var{template}, \"C\")\n\ | 1327 @deftypefnx {Built-in Function} {[@var{v1}, @var{v2}, @dots{}, @var{count}, @var{errmsg}]] =} scanf (@var{template}, \"C\")\n\ |
1325 This is equivalent to calling @code{fscanf} with @var{fid} = @code{stdin}.\n\ | 1328 This is equivalent to calling @code{fscanf} with @var{fid} = @code{stdin}.\n\ |
1326 \n\ | 1329 \n\ |
1327 It is currently not useful to call @code{scanf} in interactive\n\ | 1330 It is currently not useful to call @code{scanf} in interactive\n\ |
1398 | 1401 |
1399 return retval; | 1402 return retval; |
1400 } | 1403 } |
1401 | 1404 |
1402 DEFUN (fread, args, , | 1405 DEFUN (fread, args, , |
1403 "-*- texinfo -*-\n\ | 1406 "-*- texinfo -*-\n\ |
1404 @deftypefn {Built-in Function} {[@var{val}, @var{count}] =} fread (@var{fid}, @var{size}, @var{precision}, @var{skip}, @var{arch})\n\ | 1407 @deftypefn {Built-in Function} {[@var{val}, @var{count}] =} fread (@var{fid}, @var{size}, @var{precision}, @var{skip}, @var{arch})\n\ |
1405 Read binary data of type @var{precision} from the specified file ID\n\ | 1408 Read binary data of type @var{precision} from the specified file ID\n\ |
1406 @var{fid}.\n\ | 1409 @var{fid}.\n\ |
1407 \n\ | 1410 \n\ |
1408 The optional argument @var{size} specifies the amount of data to read\n\ | 1411 The optional argument @var{size} specifies the amount of data to read\n\ |
1659 | 1662 |
1660 return retval; | 1663 return retval; |
1661 } | 1664 } |
1662 | 1665 |
1663 DEFUN (fwrite, args, , | 1666 DEFUN (fwrite, args, , |
1664 "-*- texinfo -*-\n\ | 1667 "-*- texinfo -*-\n\ |
1665 @deftypefn {Built-in Function} {@var{count} =} fwrite (@var{fid}, @var{data}, @var{precision}, @var{skip}, @var{arch})\n\ | 1668 @deftypefn {Built-in Function} {@var{count} =} fwrite (@var{fid}, @var{data}, @var{precision}, @var{skip}, @var{arch})\n\ |
1666 Write data in binary form of type @var{precision} to the specified file\n\ | 1669 Write data in binary form of type @var{precision} to the specified file\n\ |
1667 ID @var{fid}, returning the number of values successfully written to the\n\ | 1670 ID @var{fid}, returning the number of values successfully written to the\n\ |
1668 file.\n\ | 1671 file.\n\ |
1669 \n\ | 1672 \n\ |
1720 | 1723 |
1721 return retval; | 1724 return retval; |
1722 } | 1725 } |
1723 | 1726 |
1724 DEFUNX ("feof", Ffeof, args, , | 1727 DEFUNX ("feof", Ffeof, args, , |
1725 "-*- texinfo -*-\n\ | 1728 "-*- texinfo -*-\n\ |
1726 @deftypefn {Built-in Function} {} feof (@var{fid})\n\ | 1729 @deftypefn {Built-in Function} {} feof (@var{fid})\n\ |
1727 Return 1 if an end-of-file condition has been encountered for a given\n\ | 1730 Return 1 if an end-of-file condition has been encountered for a given\n\ |
1728 file and 0 otherwise. Note that it will only return 1 if the end of the\n\ | 1731 file and 0 otherwise. Note that it will only return 1 if the end of the\n\ |
1729 file has already been encountered, not if the next read operation will\n\ | 1732 file has already been encountered, not if the next read operation will\n\ |
1730 result in an end-of-file condition.\n\ | 1733 result in an end-of-file condition.\n\ |
1747 | 1750 |
1748 return retval; | 1751 return retval; |
1749 } | 1752 } |
1750 | 1753 |
1751 DEFUNX ("ferror", Fferror, args, , | 1754 DEFUNX ("ferror", Fferror, args, , |
1752 "-*- texinfo -*-\n\ | 1755 "-*- texinfo -*-\n\ |
1753 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} ferror (@var{fid})\n\ | 1756 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} ferror (@var{fid})\n\ |
1754 @deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} ferror (@var{fid}, \"clear\")\n\ | 1757 @deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} ferror (@var{fid}, \"clear\")\n\ |
1755 Return 1 if an error condition has been encountered for the file ID\n\ | 1758 Return 1 if an error condition has been encountered for the file ID\n\ |
1756 @var{fid} and 0 otherwise. Note that it will only return 1 if an error\n\ | 1759 @var{fid} and 0 otherwise. Note that it will only return 1 if an error\n\ |
1757 has already been encountered, not if the next operation will result in\n\ | 1760 has already been encountered, not if the next operation will result in\n\ |
1797 | 1800 |
1798 return retval; | 1801 return retval; |
1799 } | 1802 } |
1800 | 1803 |
1801 DEFUN (popen, args, , | 1804 DEFUN (popen, args, , |
1802 "-*- texinfo -*-\n\ | 1805 "-*- texinfo -*-\n\ |
1803 @deftypefn {Built-in Function} {@var{fid} =} popen (@var{command}, @var{mode})\n\ | 1806 @deftypefn {Built-in Function} {@var{fid} =} popen (@var{command}, @var{mode})\n\ |
1804 Start a process and create a pipe. The name of the command to run is\n\ | 1807 Start a process and create a pipe. The name of the command to run is\n\ |
1805 given by @var{command}. The file identifier corresponding to the input\n\ | 1808 given by @var{command}. The file identifier corresponding to the input\n\ |
1806 or output stream of the process is returned in @var{fid}. The argument\n\ | 1809 or output stream of the process is returned in @var{fid}. The argument\n\ |
1807 @var{mode} may be\n\ | 1810 @var{mode} may be\n\ |
1872 | 1875 |
1873 return retval; | 1876 return retval; |
1874 } | 1877 } |
1875 | 1878 |
1876 DEFUNX ("pclose", Fpclose, args, , | 1879 DEFUNX ("pclose", Fpclose, args, , |
1877 "-*- texinfo -*-\n\ | 1880 "-*- texinfo -*-\n\ |
1878 @deftypefn {Built-in Function} {} pclose (@var{fid})\n\ | 1881 @deftypefn {Built-in Function} {} pclose (@var{fid})\n\ |
1879 Close a file identifier that was opened by @code{popen}. You may also\n\ | 1882 Close a file identifier that was opened by @code{popen}. You may also\n\ |
1880 use @code{fclose} for the same purpose.\n\ | 1883 use @code{fclose} for the same purpose.\n\ |
1881 @end deftypefn") | 1884 @end deftypefn") |
1882 { | 1885 { |
1891 | 1894 |
1892 return retval; | 1895 return retval; |
1893 } | 1896 } |
1894 | 1897 |
1895 DEFUNX ("tmpnam", Ftmpnam, args, , | 1898 DEFUNX ("tmpnam", Ftmpnam, args, , |
1896 "-*- texinfo -*-\n\ | 1899 "-*- texinfo -*-\n\ |
1897 @c List other forms of function in documentation index\n\ | 1900 @c List other forms of function in documentation index\n\ |
1898 @findex octave_tmp_file_name\n\ | 1901 @findex octave_tmp_file_name\n\ |
1899 \n\ | 1902 \n\ |
1900 @deftypefn {Built-in Function} {} tmpnam ()\n\ | 1903 @deftypefn {Built-in Function} {} tmpnam ()\n\ |
1901 @deftypefnx {Built-in Function} {} tmpnam (@var{dir})\n\ | 1904 @deftypefnx {Built-in Function} {} tmpnam (@var{dir})\n\ |
1939 } | 1942 } |
1940 | 1943 |
1941 DEFALIAS (octave_tmp_file_name, tmpnam); | 1944 DEFALIAS (octave_tmp_file_name, tmpnam); |
1942 | 1945 |
1943 DEFUN (tmpfile, args, , | 1946 DEFUN (tmpfile, args, , |
1944 "-*- texinfo -*-\n\ | 1947 "-*- texinfo -*-\n\ |
1945 @deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} tmpfile ()\n\ | 1948 @deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} tmpfile ()\n\ |
1946 Return the file ID corresponding to a new temporary file with a unique\n\ | 1949 Return the file ID corresponding to a new temporary file with a unique\n\ |
1947 name. The file is opened in binary read/write (@qcode{\"w+b\"}) mode.\n\ | 1950 name. The file is opened in binary read/write (@qcode{\"w+b\"}) mode.\n\ |
1948 The file will be deleted automatically when it is closed or when Octave\n\ | 1951 The file will be deleted automatically when it is closed or when Octave\n\ |
1949 exits.\n\ | 1952 exits.\n\ |
1990 | 1993 |
1991 return retval; | 1994 return retval; |
1992 } | 1995 } |
1993 | 1996 |
1994 DEFUN (mkstemp, args, , | 1997 DEFUN (mkstemp, args, , |
1995 "-*- texinfo -*-\n\ | 1998 "-*- texinfo -*-\n\ |
1996 @deftypefn {Built-in Function} {[@var{fid}, @var{name}, @var{msg}] =} mkstemp (@var{template}, @var{delete})\n\ | 1999 @deftypefn {Built-in Function} {[@var{fid}, @var{name}, @var{msg}] =} mkstemp (@var{template}, @var{delete})\n\ |
1997 Return the file ID corresponding to a new temporary file with a unique\n\ | 2000 Return the file ID corresponding to a new temporary file with a unique\n\ |
1998 name created from @var{template}. The last six characters of @var{template}\n\ | 2001 name created from @var{template}. The last six characters of @var{template}\n\ |
1999 must be @code{XXXXXX} and these are replaced with a string that makes the\n\ | 2002 must be @code{XXXXXX} and these are replaced with a string that makes the\n\ |
2000 filename unique. The file is then created with mode read/write and\n\ | 2003 filename unique. The file is then created with mode read/write and\n\ |
2105 | 2108 |
2106 return retval; | 2109 return retval; |
2107 } | 2110 } |
2108 | 2111 |
2109 DEFUNX ("umask", Fumask, args, , | 2112 DEFUNX ("umask", Fumask, args, , |
2110 "-*- texinfo -*-\n\ | 2113 "-*- texinfo -*-\n\ |
2111 @deftypefn {Built-in Function} {} umask (@var{mask})\n\ | 2114 @deftypefn {Built-in Function} {} umask (@var{mask})\n\ |
2112 Set the permission mask for file creation. The parameter @var{mask}\n\ | 2115 Set the permission mask for file creation. The parameter @var{mask}\n\ |
2113 is an integer, interpreted as an octal number. If successful,\n\ | 2116 is an integer, interpreted as an octal number. If successful,\n\ |
2114 returns the previous value of the mask (as an integer to be\n\ | 2117 returns the previous value of the mask (as an integer to be\n\ |
2115 interpreted as an octal number); otherwise an error message is printed.\n\ | 2118 interpreted as an octal number); otherwise an error message is printed.\n\ |
2167 | 2170 |
2168 return retval; | 2171 return retval; |
2169 } | 2172 } |
2170 | 2173 |
2171 DEFUNX ("P_tmpdir", FP_tmpdir, args, , | 2174 DEFUNX ("P_tmpdir", FP_tmpdir, args, , |
2172 "-*- texinfo -*-\n\ | 2175 "-*- texinfo -*-\n\ |
2173 @deftypefn {Built-in Function} {} P_tmpdir ()\n\ | 2176 @deftypefn {Built-in Function} {} P_tmpdir ()\n\ |
2174 Return the default name of the directory for temporary files on\n\ | 2177 Return the default name of the directory for temporary files on\n\ |
2175 this system. The name of this directory is system dependent.\n\ | 2178 this system. The name of this directory is system dependent.\n\ |
2176 @end deftypefn") | 2179 @end deftypefn") |
2177 { | 2180 { |
2189 | 2192 |
2190 // NOTE: the values of SEEK_SET, SEEK_CUR, and SEEK_END have to be | 2193 // NOTE: the values of SEEK_SET, SEEK_CUR, and SEEK_END have to be |
2191 // this way for Matlab compatibility. | 2194 // this way for Matlab compatibility. |
2192 | 2195 |
2193 DEFUNX ("SEEK_SET", FSEEK_SET, args, , | 2196 DEFUNX ("SEEK_SET", FSEEK_SET, args, , |
2194 "-*- texinfo -*-\n\ | 2197 "-*- texinfo -*-\n\ |
2195 @deftypefn {Built-in Function} {} SEEK_SET ()\n\ | 2198 @deftypefn {Built-in Function} {} SEEK_SET ()\n\ |
2196 @deftypefnx {Built-in Function} {} SEEK_CUR ()\n\ | 2199 @deftypefnx {Built-in Function} {} SEEK_CUR ()\n\ |
2197 @deftypefnx {Built-in Function} {} SEEK_END ()\n\ | 2200 @deftypefnx {Built-in Function} {} SEEK_END ()\n\ |
2198 Return the numerical value to pass to @code{fseek} to perform\n\ | 2201 Return the numerical value to pass to @code{fseek} to perform\n\ |
2199 one of the following actions:\n\ | 2202 one of the following actions:\n\ |
2213 { | 2216 { |
2214 return const_value ("SEEK_SET", args, -1); | 2217 return const_value ("SEEK_SET", args, -1); |
2215 } | 2218 } |
2216 | 2219 |
2217 DEFUNX ("SEEK_CUR", FSEEK_CUR, args, , | 2220 DEFUNX ("SEEK_CUR", FSEEK_CUR, args, , |
2218 "-*- texinfo -*-\n\ | 2221 "-*- texinfo -*-\n\ |
2219 @deftypefn {Built-in Function} {} SEEK_CUR ()\n\ | 2222 @deftypefn {Built-in Function} {} SEEK_CUR ()\n\ |
2220 Return the numerical value to pass to @code{fseek} to\n\ | 2223 Return the numerical value to pass to @code{fseek} to\n\ |
2221 position the file pointer relative to the current position.\n\ | 2224 position the file pointer relative to the current position.\n\ |
2222 @seealso{SEEK_SET, SEEK_END}.\n\ | 2225 @seealso{SEEK_SET, SEEK_END}.\n\ |
2223 @end deftypefn") | 2226 @end deftypefn") |
2224 { | 2227 { |
2225 return const_value ("SEEK_CUR", args, 0); | 2228 return const_value ("SEEK_CUR", args, 0); |
2226 } | 2229 } |
2227 | 2230 |
2228 DEFUNX ("SEEK_END", FSEEK_END, args, , | 2231 DEFUNX ("SEEK_END", FSEEK_END, args, , |
2229 "-*- texinfo -*-\n\ | 2232 "-*- texinfo -*-\n\ |
2230 @deftypefn {Built-in Function} {} SEEK_END ()\n\ | 2233 @deftypefn {Built-in Function} {} SEEK_END ()\n\ |
2231 Return the numerical value to pass to @code{fseek} to\n\ | 2234 Return the numerical value to pass to @code{fseek} to\n\ |
2232 position the file pointer relative to the end of the file.\n\ | 2235 position the file pointer relative to the end of the file.\n\ |
2233 @seealso{SEEK_SET, SEEK_CUR}.\n\ | 2236 @seealso{SEEK_SET, SEEK_CUR}.\n\ |
2234 @end deftypefn") | 2237 @end deftypefn") |
2251 | 2254 |
2252 return retval; | 2255 return retval; |
2253 } | 2256 } |
2254 | 2257 |
2255 DEFUNX ("stdin", Fstdin, args, , | 2258 DEFUNX ("stdin", Fstdin, args, , |
2256 "-*- texinfo -*-\n\ | 2259 "-*- texinfo -*-\n\ |
2257 @deftypefn {Built-in Function} {} stdin ()\n\ | 2260 @deftypefn {Built-in Function} {} stdin ()\n\ |
2258 Return the numeric value corresponding to the standard input stream.\n\ | 2261 Return the numeric value corresponding to the standard input stream.\n\ |
2259 When Octave is used interactively, this is filtered through the command\n\ | 2262 When Octave is used interactively, this is filtered through the command\n\ |
2260 line editing functions.\n\ | 2263 line editing functions.\n\ |
2261 @seealso{stdout, stderr}\n\ | 2264 @seealso{stdout, stderr}\n\ |
2263 { | 2266 { |
2264 return const_value ("stdin", args, stdin_file); | 2267 return const_value ("stdin", args, stdin_file); |
2265 } | 2268 } |
2266 | 2269 |
2267 DEFUNX ("stdout", Fstdout, args, , | 2270 DEFUNX ("stdout", Fstdout, args, , |
2268 "-*- texinfo -*-\n\ | 2271 "-*- texinfo -*-\n\ |
2269 @deftypefn {Built-in Function} {} stdout ()\n\ | 2272 @deftypefn {Built-in Function} {} stdout ()\n\ |
2270 Return the numeric value corresponding to the standard output stream.\n\ | 2273 Return the numeric value corresponding to the standard output stream.\n\ |
2271 Data written to the standard output is normally filtered through the pager.\n\ | 2274 Data written to the standard output is normally filtered through the pager.\n\ |
2272 @seealso{stdin, stderr}\n\ | 2275 @seealso{stdin, stderr}\n\ |
2273 @end deftypefn") | 2276 @end deftypefn") |
2274 { | 2277 { |
2275 return const_value ("stdout", args, stdout_file); | 2278 return const_value ("stdout", args, stdout_file); |
2276 } | 2279 } |
2277 | 2280 |
2278 DEFUNX ("stderr", Fstderr, args, , | 2281 DEFUNX ("stderr", Fstderr, args, , |
2279 "-*- texinfo -*-\n\ | 2282 "-*- texinfo -*-\n\ |
2280 @deftypefn {Built-in Function} {} stderr ()\n\ | 2283 @deftypefn {Built-in Function} {} stderr ()\n\ |
2281 Return the numeric value corresponding to the standard error stream.\n\ | 2284 Return the numeric value corresponding to the standard error stream.\n\ |
2282 Even if paging is turned on, the standard error is not sent to the\n\ | 2285 Even if paging is turned on, the standard error is not sent to the\n\ |
2283 pager. It is useful for error messages and prompts.\n\ | 2286 pager. It is useful for error messages and prompts.\n\ |
2284 @seealso{stdin, stdout}\n\ | 2287 @seealso{stdin, stdout}\n\ |