Mercurial > hg > octave-nkf
annotate libinterp/corefcn/hook-fcn.cc @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
16385
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
16892
diff
changeset
|
3 Copyright (C) 2013-2015 John W. Eaton |
16385
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 This file is part of Octave. |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 option) any later version. |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 for more details. |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 */ |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 #include <config.h> |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 #include "hook-fcn.h" |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 hook_function::hook_function (const octave_value& f, const octave_value& d) |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 { |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 if (f.is_string ()) |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 { |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 std::string name = f.string_value (); |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 rep = new named_hook_function (name, d); |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 } |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 else if (f.is_function_handle ()) |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 { |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 rep = new fcn_handle_hook_function (f, d); |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 } |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 else |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 error ("invalid hook function"); |
a1690c3e93eb
move hook_function constructor to .cc file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 } |