Mercurial > octave-libgccjit
comparison src/file-io.cc @ 14438:6a8c3cd326fd
doc: Improve seealso links between low-level file I/O functions.
* file-io.cc: Improve seealso links between low-level file I/O functions.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 05 Mar 2012 21:05:37 -0800 |
parents | 12097d20a23e |
children |
comparison
equal
deleted
inserted
replaced
14437:62a2ef6c09a4 | 14438:6a8c3cd326fd |
---|---|
215 @deftypefn {Built-in Function} {} fclose (@var{fid})\n\ | 215 @deftypefn {Built-in Function} {} fclose (@var{fid})\n\ |
216 @deftypefnx {Built-in Function} {} fclose (\"all\")\n\ | 216 @deftypefnx {Built-in Function} {} fclose (\"all\")\n\ |
217 Close the specified file. If successful, @code{fclose} returns 0,\n\ | 217 Close the specified file. If successful, @code{fclose} returns 0,\n\ |
218 otherwise, it returns -1. The second form of the @code{fclose} call closes\n\ | 218 otherwise, it returns -1. The second form of the @code{fclose} call closes\n\ |
219 all open files except @code{stdout}, @code{stderr}, and @code{stdin}.\n\ | 219 all open files except @code{stdout}, @code{stderr}, and @code{stdin}.\n\ |
220 @seealso{fopen, fseek, ftell}\n\ | 220 @seealso{fopen, freport}\n\ |
221 @end deftypefn") | 221 @end deftypefn") |
222 { | 222 { |
223 octave_value retval = -1; | 223 octave_value retval = -1; |
224 | 224 |
225 int nargin = args.length (); | 225 int nargin = args.length (); |
234 | 234 |
235 DEFUN (fclear, args, , | 235 DEFUN (fclear, args, , |
236 "-*- texinfo -*-\n\ | 236 "-*- texinfo -*-\n\ |
237 @deftypefn {Built-in Function} {} fclear (@var{fid})\n\ | 237 @deftypefn {Built-in Function} {} fclear (@var{fid})\n\ |
238 Clear the stream state for the specified file.\n\ | 238 Clear the stream state for the specified file.\n\ |
239 @seealso{fopen}\n\ | |
239 @end deftypefn") | 240 @end deftypefn") |
240 { | 241 { |
241 octave_value retval; | 242 octave_value retval; |
242 | 243 |
243 int nargin = args.length (); | 244 int nargin = args.length (); |
312 character.\n\ | 313 character.\n\ |
313 \n\ | 314 \n\ |
314 If there are no more characters to read, @code{fgetl} returns @minus{}1.\n\ | 315 If there are no more characters to read, @code{fgetl} returns @minus{}1.\n\ |
315 \n\ | 316 \n\ |
316 To read a line and return the terminating newline see @code{fgets}.\n\ | 317 To read a line and return the terminating newline see @code{fgets}.\n\ |
317 @seealso{fgets, fputs, fopen, fread, fscanf}\n\ | 318 @seealso{fgets, fscanf, fread, fopen}\n\ |
318 @end deftypefn") | 319 @end deftypefn") |
319 { | 320 { |
320 static std::string who = "fgetl"; | 321 static std::string who = "fgetl"; |
321 | 322 |
322 octave_value_list retval; | 323 octave_value_list retval; |
363 character.\n\ | 364 character.\n\ |
364 \n\ | 365 \n\ |
365 If there are no more characters to read, @code{fgets} returns @minus{}1.\n\ | 366 If there are no more characters to read, @code{fgets} returns @minus{}1.\n\ |
366 \n\ | 367 \n\ |
367 To read a line and discard the terminating newline see @code{fgetl}.\n\ | 368 To read a line and discard the terminating newline see @code{fgetl}.\n\ |
368 @seealso{fgetl, fputs, fopen, fread, fscanf}\n\ | 369 @seealso{fputs, fgetl, fscanf, fread, fopen}\n\ |
369 @end deftypefn") | 370 @end deftypefn") |
370 { | 371 { |
371 static std::string who = "fgets"; | 372 static std::string who = "fgets"; |
372 | 373 |
373 octave_value_list retval; | 374 octave_value_list retval; |
414 If @var{count} is omitted, it defaults to 1. @var{count} may also be\n\ | 415 If @var{count} is omitted, it defaults to 1. @var{count} may also be\n\ |
415 @code{Inf}, in which case lines are skipped until the end of the file.\n\ | 416 @code{Inf}, in which case lines are skipped until the end of the file.\n\ |
416 This form is suitable for counting the number of lines in a file.\n\ | 417 This form is suitable for counting the number of lines in a file.\n\ |
417 \n\ | 418 \n\ |
418 Returns the number of lines skipped (end-of-line sequences encountered).\n\ | 419 Returns the number of lines skipped (end-of-line sequences encountered).\n\ |
419 @seealso{fgetl, fgets}\n\ | 420 @seealso{fgetl, fgets, fscanf, fopen}\n\ |
420 @end deftypefn") | 421 @end deftypefn") |
421 { | 422 { |
422 static std::string who = "fskipl"; | 423 static std::string who = "fskipl"; |
423 | 424 |
424 octave_value retval; | 425 octave_value retval; |
666 @end table\n\ | 667 @end table\n\ |
667 \n\ | 668 \n\ |
668 @noindent\n\ | 669 @noindent\n\ |
669 however, conversions are currently only supported for @samp{native}\n\ | 670 however, conversions are currently only supported for @samp{native}\n\ |
670 @samp{ieee-be}, and @samp{ieee-le} formats.\n\ | 671 @samp{ieee-be}, and @samp{ieee-le} formats.\n\ |
671 @seealso{fclose, fgets, fputs, fread, fseek, ferror, fprintf, fscanf, ftell, fwrite}\n\ | 672 @seealso{fclose, fgets, fgetl, fscanf, fread, fputs, fdisp, fprintf, fwrite, fskipl, fseek, frewind, ftell, feof, ferror, fclear, fflush, freport}\n\ |
672 @end deftypefn") | 673 @end deftypefn") |
673 { | 674 { |
674 octave_value_list retval; | 675 octave_value_list retval; |
675 | 676 |
676 retval(0) = -1.0; | 677 retval(0) = -1.0; |
751 @print{} 1 w stdout\n\ | 752 @print{} 1 w stdout\n\ |
752 @print{} 2 w stderr\n\ | 753 @print{} 2 w stderr\n\ |
753 @print{} 3 r myfile\n\ | 754 @print{} 3 r myfile\n\ |
754 @end group\n\ | 755 @end group\n\ |
755 @end example\n\ | 756 @end example\n\ |
757 @seealso{fopen, fclose}\n\ | |
756 @end deftypefn") | 758 @end deftypefn") |
757 { | 759 { |
758 octave_value_list retval; | 760 octave_value_list retval; |
759 | 761 |
760 int nargin = args.length (); | 762 int nargin = args.length (); |
771 "-*- texinfo -*-\n\ | 773 "-*- texinfo -*-\n\ |
772 @deftypefn {Built-in Function} {} frewind (@var{fid})\n\ | 774 @deftypefn {Built-in Function} {} frewind (@var{fid})\n\ |
773 Move the file pointer to the beginning of the file @var{fid}, returning\n\ | 775 Move the file pointer to the beginning of the file @var{fid}, returning\n\ |
774 0 for success, and -1 if an error was encountered. It is equivalent to\n\ | 776 0 for success, and -1 if an error was encountered. It is equivalent to\n\ |
775 @code{fseek (@var{fid}, 0, SEEK_SET)}.\n\ | 777 @code{fseek (@var{fid}, 0, SEEK_SET)}.\n\ |
778 @seealso{fseek, ftell, fopen}\n\ | |
776 @end deftypefn") | 779 @end deftypefn") |
777 { | 780 { |
778 octave_value retval; | 781 octave_value retval; |
779 | 782 |
780 int result = -1; | 783 int result = -1; |
797 return retval; | 800 return retval; |
798 } | 801 } |
799 | 802 |
800 DEFUN (fseek, args, , | 803 DEFUN (fseek, args, , |
801 "-*- texinfo -*-\n\ | 804 "-*- texinfo -*-\n\ |
802 @deftypefn {Built-in Function} {} fseek (@var{fid}, @var{offset}, @var{origin})\n\ | 805 @deftypefn {Built-in Function} {} fseek (@var{fid}, @var{offset})\n\ |
806 @deftypefnx {Built-in Function} {} fseek (@var{fid}, @var{offset}, @var{origin})\n\ | |
807 @deftypefnx {Built-in Function} {@var{status} =} fseek (@dots{})\n\ | |
803 Set the file pointer to any location within the file @var{fid}.\n\ | 808 Set the file pointer to any location within the file @var{fid}.\n\ |
804 \n\ | 809 \n\ |
805 The pointer is positioned @var{offset} characters from the @var{origin},\n\ | 810 The pointer is positioned @var{offset} characters from the @var{origin},\n\ |
806 which may be one of the predefined variables @w{@code{SEEK_CUR}} (current\n\ | 811 which may be one of the predefined variables @w{@code{SEEK_CUR}} (current\n\ |
807 position), @w{@code{SEEK_SET}} (beginning), or @w{@code{SEEK_END}} (end of\n\ | 812 position), @w{@code{SEEK_SET}} (beginning), or @w{@code{SEEK_END}} (end of\n\ |
808 file) or strings \"cof\", \"bof\" or \"eof\". If @var{origin} is omitted,\n\ | 813 file) or strings \"cof\", \"bof\" or \"eof\". If @var{origin} is omitted,\n\ |
809 @w{@code{SEEK_SET}} is assumed. The offset must be zero, or a value returned\n\ | 814 @w{@code{SEEK_SET}} is assumed. @var{offset} may be positive, negative, or zero but not all combinations of @var{origin} and @var{offset} can be realized.\n\ |
810 by @code{ftell} (in which case @var{origin} must be @w{@code{SEEK_SET}}).\n\ | |
811 \n\ | 815 \n\ |
812 Return 0 on success and -1 on error.\n\ | 816 Return 0 on success and -1 on error.\n\ |
813 @seealso{ftell, fopen, fclose}\n\ | 817 @seealso{fskipl, frewind, ftell, fopen}\n\ |
814 @end deftypefn") | 818 @end deftypefn") |
815 { | 819 { |
816 octave_value retval = -1; | 820 octave_value retval = -1; |
817 | 821 |
818 int nargin = args.length (); | 822 int nargin = args.length (); |
838 DEFUN (ftell, args, , | 842 DEFUN (ftell, args, , |
839 "-*- texinfo -*-\n\ | 843 "-*- texinfo -*-\n\ |
840 @deftypefn {Built-in Function} {} ftell (@var{fid})\n\ | 844 @deftypefn {Built-in Function} {} ftell (@var{fid})\n\ |
841 Return the position of the file pointer as the number of characters\n\ | 845 Return the position of the file pointer as the number of characters\n\ |
842 from the beginning of the file @var{fid}.\n\ | 846 from the beginning of the file @var{fid}.\n\ |
843 @seealso{fseek, fopen, fclose}\n\ | 847 @seealso{fseek, feof, fopen}\n\ |
844 @end deftypefn") | 848 @end deftypefn") |
845 { | 849 { |
846 octave_value retval = -1; | 850 octave_value retval = -1; |
847 | 851 |
848 int nargin = args.length (); | 852 int nargin = args.length (); |
864 "-*- texinfo -*-\n\ | 868 "-*- texinfo -*-\n\ |
865 @deftypefn {Built-in Function} {} fprintf (@var{fid}, @var{template}, @dots{})\n\ | 869 @deftypefn {Built-in Function} {} fprintf (@var{fid}, @var{template}, @dots{})\n\ |
866 This function is just like @code{printf}, except that the output is\n\ | 870 This function is just like @code{printf}, except that the output is\n\ |
867 written to the stream @var{fid} instead of @code{stdout}.\n\ | 871 written to the stream @var{fid} instead of @code{stdout}.\n\ |
868 If @var{fid} is omitted, the output is written to @code{stdout}.\n\ | 872 If @var{fid} is omitted, the output is written to @code{stdout}.\n\ |
869 @seealso{printf, sprintf, fread, fscanf, fopen, fclose}\n\ | 873 @seealso{fputs, fdisp, fwrite, fscanf, printf, sprintf, fopen}\n\ |
870 @end deftypefn") | 874 @end deftypefn") |
871 { | 875 { |
872 static std::string who = "fprintf"; | 876 static std::string who = "fprintf"; |
873 | 877 |
874 octave_value retval; | 878 octave_value retval; |
975 "-*- texinfo -*-\n\ | 979 "-*- texinfo -*-\n\ |
976 @deftypefn {Built-in Function} {} fputs (@var{fid}, @var{string})\n\ | 980 @deftypefn {Built-in Function} {} fputs (@var{fid}, @var{string})\n\ |
977 Write a string to a file with no formatting.\n\ | 981 Write a string to a file with no formatting.\n\ |
978 \n\ | 982 \n\ |
979 Return a non-negative number on success and EOF on error.\n\ | 983 Return a non-negative number on success and EOF on error.\n\ |
980 @seealso{scanf, sscanf, fread, fprintf, fgets, fscanf}\n\ | 984 @seealso{fdisp, fprintf, fwrite, fopen}\n\ |
981 @end deftypefn") | 985 @end deftypefn") |
982 { | 986 { |
983 static std::string who = "fputs"; | 987 static std::string who = "fputs"; |
984 | 988 |
985 octave_value retval = -1; | 989 octave_value retval = -1; |
1003 "-*- texinfo -*-\n\ | 1007 "-*- texinfo -*-\n\ |
1004 @deftypefn {Built-in Function} {} puts (@var{string})\n\ | 1008 @deftypefn {Built-in Function} {} puts (@var{string})\n\ |
1005 Write a string to the standard output with no formatting.\n\ | 1009 Write a string to the standard output with no formatting.\n\ |
1006 \n\ | 1010 \n\ |
1007 Return a non-negative number on success and EOF on error.\n\ | 1011 Return a non-negative number on success and EOF on error.\n\ |
1012 @seealso{fputs, disp}\n\ | |
1008 @end deftypefn") | 1013 @end deftypefn") |
1009 { | 1014 { |
1010 static std::string who = "puts"; | 1015 static std::string who = "puts"; |
1011 | 1016 |
1012 octave_value retval = -1; | 1017 octave_value retval = -1; |
1128 @ifclear OCTAVE_MANUAL\n\ | 1133 @ifclear OCTAVE_MANUAL\n\ |
1129 \n\ | 1134 \n\ |
1130 See the Formatted Input section of the GNU Octave manual for a\n\ | 1135 See the Formatted Input section of the GNU Octave manual for a\n\ |
1131 complete description of the syntax of the template string.\n\ | 1136 complete description of the syntax of the template string.\n\ |
1132 @end ifclear\n\ | 1137 @end ifclear\n\ |
1133 @seealso{scanf, sscanf, fread, fprintf, fgets, fputs}\n\ | 1138 @seealso{fgets, fgetl, fread, scanf, sscanf, fopen}\n\ |
1134 @end deftypefn") | 1139 @end deftypefn") |
1135 { | 1140 { |
1136 static std::string who = "fscanf"; | 1141 static std::string who = "fscanf"; |
1137 | 1142 |
1138 octave_value_list retval; | 1143 octave_value_list retval; |
1597 Conversions are currently only supported for @code{\"ieee-be\"} and\n\ | 1602 Conversions are currently only supported for @code{\"ieee-be\"} and\n\ |
1598 @code{\"ieee-le\"} formats.\n\ | 1603 @code{\"ieee-le\"} formats.\n\ |
1599 \n\ | 1604 \n\ |
1600 The data read from the file is returned in @var{val}, and the number of\n\ | 1605 The data read from the file is returned in @var{val}, and the number of\n\ |
1601 values read is returned in @code{count}\n\ | 1606 values read is returned in @code{count}\n\ |
1602 @seealso{fwrite, fopen, fclose}\n\ | 1607 @seealso{fwrite, fgets, fgetl, fscanf, fopen}\n\ |
1603 @end deftypefn") | 1608 @end deftypefn") |
1604 { | 1609 { |
1605 octave_value_list retval; | 1610 octave_value_list retval; |
1606 | 1611 |
1607 int nargin = args.length (); | 1612 int nargin = args.length (); |
1714 The remaining arguments @var{precision}, @var{skip}, and @var{arch} are\n\ | 1719 The remaining arguments @var{precision}, @var{skip}, and @var{arch} are\n\ |
1715 optional, and are interpreted as described for @code{fread}.\n\ | 1720 optional, and are interpreted as described for @code{fread}.\n\ |
1716 \n\ | 1721 \n\ |
1717 The behavior of @code{fwrite} is undefined if the values in @var{data}\n\ | 1722 The behavior of @code{fwrite} is undefined if the values in @var{data}\n\ |
1718 are too large to fit in the specified precision.\n\ | 1723 are too large to fit in the specified precision.\n\ |
1719 @seealso{fread, fopen, fclose}\n\ | 1724 @seealso{fread, fputs, fprintf, fopen}\n\ |
1720 @end deftypefn") | 1725 @end deftypefn") |
1721 { | 1726 { |
1722 octave_value retval = -1; | 1727 octave_value retval = -1; |
1723 | 1728 |
1724 int nargin = args.length (); | 1729 int nargin = args.length (); |
1767 @deftypefn {Built-in Function} {} feof (@var{fid})\n\ | 1772 @deftypefn {Built-in Function} {} feof (@var{fid})\n\ |
1768 Return 1 if an end-of-file condition has been encountered for a given\n\ | 1773 Return 1 if an end-of-file condition has been encountered for a given\n\ |
1769 file and 0 otherwise. Note that it will only return 1 if the end of the\n\ | 1774 file and 0 otherwise. Note that it will only return 1 if the end of the\n\ |
1770 file has already been encountered, not if the next read operation will\n\ | 1775 file has already been encountered, not if the next read operation will\n\ |
1771 result in an end-of-file condition.\n\ | 1776 result in an end-of-file condition.\n\ |
1772 @seealso{fread, fopen, fclose}\n\ | 1777 @seealso{fread, fopen}\n\ |
1773 @end deftypefn") | 1778 @end deftypefn") |
1774 { | 1779 { |
1775 octave_value retval = -1; | 1780 octave_value retval = -1; |
1776 | 1781 |
1777 int nargin = args.length (); | 1782 int nargin = args.length (); |
1789 return retval; | 1794 return retval; |
1790 } | 1795 } |
1791 | 1796 |
1792 DEFUNX ("ferror", Fferror, args, , | 1797 DEFUNX ("ferror", Fferror, args, , |
1793 "-*- texinfo -*-\n\ | 1798 "-*- texinfo -*-\n\ |
1794 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} ferror (@var{fid}, \"clear\")\n\ | 1799 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} ferror (@var{fid})\n\ |
1800 @deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} ferror (@var{fid}, \"clear\")\n\ | |
1795 Return 1 if an error condition has been encountered for the file ID\n\ | 1801 Return 1 if an error condition has been encountered for the file ID\n\ |
1796 @var{fid} and 0 otherwise. Note that it will only return 1 if an error\n\ | 1802 @var{fid} and 0 otherwise. Note that it will only return 1 if an error\n\ |
1797 has already been encountered, not if the next operation will result in\n\ | 1803 has already been encountered, not if the next operation will result in\n\ |
1798 an error condition.\n\ | 1804 an error condition.\n\ |
1799 \n\ | 1805 \n\ |
1800 The second argument is optional. If it is supplied, also clear the\n\ | 1806 The second argument is optional. If it is supplied, also clear the\n\ |
1801 error condition.\n\ | 1807 error condition.\n\ |
1808 @seealso{fclear, fopen}\n\ | |
1802 @end deftypefn") | 1809 @end deftypefn") |
1803 { | 1810 { |
1804 octave_value_list retval; | 1811 octave_value_list retval; |
1805 | 1812 |
1806 int nargin = args.length (); | 1813 int nargin = args.length (); |