Mercurial > hg > octave-nkf
annotate examples/fortdemo.cc @ 12830:208f0a181be6
codesprint: Stop reporting print_usage() as missing tests.
* print_usage.m: Add %!assert(1) to stop reporting on file.
No real tests possible.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 16 Jul 2011 14:16:52 -0700 |
parents | db1f49eaba6b |
children | 460a3c6d8bf1 |
rev | line source |
---|---|
6572 | 1 #include <octave/oct.h> |
2 #include <octave/f77-fcn.h> | |
3 | |
12174 | 4 extern "C" |
6572 | 5 { |
12174 | 6 F77_RET_T |
7 F77_FUNC (fortsub, FORTSUB) | |
8 (const int&, double*, F77_CHAR_ARG_DECL | |
6572 | 9 F77_CHAR_ARG_LEN_DECL); |
10 } | |
11 | |
12 DEFUN_DLD (fortdemo , args , , "Fortran Demo.") | |
13 { | |
12174 | 14 octave_value_list retval; |
6572 | 15 int nargin = args.length(); |
16 if (nargin != 1) | |
17 print_usage (); | |
18 else | |
19 { | |
20 NDArray a = args(0).array_value (); | |
21 if (! error_state) | |
22 { | |
23 double *av = a.fortran_vec (); | |
24 octave_idx_type na = a.nelem (); | |
25 OCTAVE_LOCAL_BUFFER (char, ctmp, 128); | |
26 | |
12174 | 27 F77_XFCN (fortsub, FORTSUB, (na, av, ctmp |
7081 | 28 F77_CHAR_ARG_LEN (128))); |
6572 | 29 |
9932
6cb30a539481
untabify files in examples directory
John W. Eaton <jwe@octave.org>
parents:
9053
diff
changeset
|
30 retval(1) = std::string (ctmp); |
6cb30a539481
untabify files in examples directory
John W. Eaton <jwe@octave.org>
parents:
9053
diff
changeset
|
31 retval(0) = a; |
6572 | 32 } |
33 } | |
34 return retval; | |
35 } |