FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mercury/java/runtime/MercuryOptions.java at master · Mercury-Language/mercury · GitHub
Mercury-Language
/
mercury
Public
Notifications
You must be signed in to change notification settings
Fork
71
Star
1.1k
Code
Issues
13
Pull requests
8
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
mercury
/
java
/
runtime
/
MercuryOptions.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (55 loc) · 1.67 KB
Breadcrumbs
mercury
/
java
/
runtime
/
MercuryOptions.java
Copy path
File metadata and controls
63 lines (55 loc) · 1.67 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// vim: ts=4 sw=4 expandtab ft=java
//
// Copyright (C) 2014, 2016, 2018, 2024 The Mercury Team.
// This file is distributed under the terms specified in COPYING.LIB.
//
package
jmercury
.
runtime
;
import
java
.
util
.
List
;
/**
* Process the MERCURY_OPTIONS environment variable.
*/
public
class
MercuryOptions
{
private
int
num_processors
;
/**
* Create a new MercuryOptions object.
* This constructor is package-private (no access declaration).
*/
MercuryOptions
()
{
// Zero means autodetect.
num_processors
=
0
;
}
public
void
process
()
{
String
options
=
System
.
getenv
(
"MERCURY_OPTIONS"
);
if
(
options
==
null
) {
return
;
}
Getopt
getopt
=
new
Getopt
(
options
);
for
(
Getopt
.
Option
option
:
getopt
) {
if
(
option
.
optionIs
(
"P"
)) {
try
{
num_processors
=
option
.
getValueInt
();
}
catch
(
java
.
lang
.
NumberFormatException
e
) {
throw
new
MercuryFatalError
(
"the value of the -P option must be "
+
"a non-negative integer"
,
e
);
}
}
else
{
throw
new
MercuryFatalError
(
"Unrecognized option: "
+
option
);
}
}
List
<
String
>
args
=
getopt
.
getArguments
();
if
(
args
.
size
() >
0
) {
throw
new
MercuryFatalError
(
"Error parsing MERCURY_OPTIONS environment variable,"
+
" unexpected: "
+
args
.
get
(
0
));
}
}
/**
* Get the number of processors in the machine.
*/
public
int
getNumProcessors
() {
return
num_processors
;
}
}
Back
|
FazBrowse Home
|
New Git URL