Mercurial > hg > octave-lyh
annotate examples/fortdemo.cc @ 17519:417fae0562da
-Werror at libinterp/corefcn/jit-typeinfo.cc
author | LYH <lyh.kernel@gmail.com> |
---|---|
date | Fri, 27 Sep 2013 02:59:51 +0800 |
parents | be41c30bcb44 |
children |
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 | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
12 DEFUN_DLD (fortdemo, args, , "Fortran Demo") |
6572 | 13 { |
12174 | 14 octave_value_list retval; |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
15 int nargin = args.length (); |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
16 |
6572 | 17 if (nargin != 1) |
18 print_usage (); | |
19 else | |
20 { | |
21 NDArray a = args(0).array_value (); | |
22 if (! error_state) | |
23 { | |
24 double *av = a.fortran_vec (); | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
25 octave_idx_type na = a.numel (); |
6572 | 26 OCTAVE_LOCAL_BUFFER (char, ctmp, 128); |
27 | |
12174 | 28 F77_XFCN (fortsub, FORTSUB, (na, av, ctmp |
7081 | 29 F77_CHAR_ARG_LEN (128))); |
6572 | 30 |
9932
6cb30a539481
untabify files in examples directory
John W. Eaton <jwe@octave.org>
parents:
9053
diff
changeset
|
31 retval(1) = std::string (ctmp); |
6cb30a539481
untabify files in examples directory
John W. Eaton <jwe@octave.org>
parents:
9053
diff
changeset
|
32 retval(0) = a; |
6572 | 33 } |
34 } | |
35 return retval; | |
36 } |