Mercurial > hg > octave-nkf
annotate examples/fortrandemo.cc @ 19022:5eca3080c7cd
maint: Merge Stefan's changesets onto default after verification.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 14 Jun 2014 13:24:46 -0700 |
parents | 4b32677b6229 |
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 |
18437
4b32677b6229
Rename Fortran example files from 'fort' prefix to 'fortran' prefix.
Rik <rik@octave.org>
parents:
17791
diff
changeset
|
7 F77_FUNC (fortransub, FORTSUB) |
17791
224e76250443
Use GNU style coding conventions for code in examples/
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
8 (const int&, double*, F77_CHAR_ARG_DECL F77_CHAR_ARG_LEN_DECL); |
6572 | 9 } |
10 | |
18437
4b32677b6229
Rename Fortran example files from 'fort' prefix to 'fortran' prefix.
Rik <rik@octave.org>
parents:
17791
diff
changeset
|
11 DEFUN_DLD (fortrandemo, args, , "Fortran Demo") |
6572 | 12 { |
12174 | 13 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
|
14 int nargin = args.length (); |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
15 |
6572 | 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 (); | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
14846
diff
changeset
|
24 octave_idx_type na = a.numel (); |
6572 | 25 OCTAVE_LOCAL_BUFFER (char, ctmp, 128); |
26 | |
18437
4b32677b6229
Rename Fortran example files from 'fort' prefix to 'fortran' prefix.
Rik <rik@octave.org>
parents:
17791
diff
changeset
|
27 F77_XFCN (fortransub, FORTSUB, |
17791
224e76250443
Use GNU style coding conventions for code in examples/
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
28 (na, av, ctmp 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 } |