annotate liboctave/wrappers/nproc-wrapper.c @ 23083:e9a0469dedd9 stable

maint: strip extra trailing newlines from files.
author John W. Eaton <jwe@octave.org>
date Fri, 20 Jan 2017 12:19:08 -0500
parents 4caa7b28d183
children ef4d915df748 3ac9f9ecfae5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21888
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 Copyright (C) 2016 John W. Eaton
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 This file is part of Octave.
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 option) any later version.
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 for more details.
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 */
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 // num_processors is provided by gnulib. We don't include gnulib
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 // headers directly in Octave's C++ source files to avoid problems that
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 // may be caused by the way that gnulib overrides standard library
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 // functions.
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #if defined (HAVE_CONFIG_H)
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 # include "config.h"
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #endif
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include "nproc.h"
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #include "nproc-wrapper.h"
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 unsigned long int
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 octave_num_processors_wrapper (enum octave_nproc_query octave_query)
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 {
21902
a46c49f0d52e * nproc-wrapper.c: Set default value for query (bug #48139)
John W. Eaton <jwe@octave.org>
parents: 21888
diff changeset
39 enum nproc_query query = NPROC_CURRENT;
21888
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 switch (octave_query)
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 {
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 case OCTAVE_NPROC_ALL:
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 query = NPROC_ALL;
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 break;
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 case OCTAVE_NPROC_CURRENT:
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 query = NPROC_CURRENT;
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 break;
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 case OCTAVE_NPROC_CURRENT_OVERRIDABLE:
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 query = NPROC_CURRENT_OVERRIDABLE;
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 break;
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 }
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 return num_processors (query);
00f1249f2483 create wrappers for some gnulib functions
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 }