Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
qbox-public
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
qbox
qbox-public
Commits
08279546
Commit
08279546
authored
Aug 16, 2018
by
Francois Gygi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite and simplify UserInterface
parent
218356eb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
48 deletions
+22
-48
UserInterface.C
src/UserInterface.C
+0
-0
UserInterface.h
src/UserInterface.h
+7
-7
qb.C
src/qb.C
+15
-41
No files found.
src/UserInterface.C
View file @
08279546
This diff is collapsed.
Click to expand it.
src/UserInterface.h
View file @
08279546
...
...
@@ -15,17 +15,15 @@
// UserInterface.h:
//
////////////////////////////////////////////////////////////////////////////////
// $ Id: $
#ifndef USER_INTERFACE_H
#define USER_INTERFACE_H
#include <iostream>
#include <string>
#include <cstring>
#include <
iomanip>
#include <cstring>
// strncpy(), strtok()
#include <
cstdlib> // free(), system()
#include <list>
#include <algorithm>
class
UserInterface
;
...
...
@@ -53,7 +51,8 @@ class UserInterface
{
private
:
int
readCmd
(
char
*
s
,
int
max
,
std
::
istream
&
fp
,
bool
echo
);
int
readCmd
(
std
::
string
&
s
,
std
::
istream
&
is
,
bool
echo
);
void
execCmd
(
std
::
string
s
,
std
::
string
prompt
);
bool
terminate_
;
bool
onpe0_
;
...
...
@@ -108,9 +107,10 @@ class UserInterface
}
};
void
processCmds
(
std
::
istream
&
cmdstream
,
const
char
*
prompt
,
bool
echo
);
void
processCmds
(
std
::
istream
&
cmdstream
,
const
std
::
string
prompt
,
bool
echo
);
void
processCmdsServer
(
std
::
string
inputfilename
,
std
::
string
outputfilename
,
const
char
*
prompt
,
bool
echo
);
const
std
::
string
prompt
,
bool
echo
);
void
terminate
(
void
)
{
terminate_
=
true
;
}
...
...
src/qb.C
View file @
08279546
...
...
@@ -24,9 +24,6 @@ using namespace std;
#include <unistd.h>
#include <cstdlib>
#include <fstream>
#if AIX
#include<filehdr.h>
#endif
#include "isodate.h"
#include "release.h"
...
...
@@ -119,10 +116,6 @@ using namespace std;
#include "WfDyn.h"
#include "Xc.h"
#if BGLDEBUG
#include <rts.h>
#endif
int
main
(
int
argc
,
char
**
argv
,
char
**
envp
)
{
Timer
tm
;
...
...
@@ -132,21 +125,6 @@ int main(int argc, char **argv, char **envp)
MPI_Init
(
&
argc
,
&
argv
);
#endif
#if BGLDEBUG
{
int
myrank
,
mysize
;
BGLPersonality
personality
;
rts_get_personality
(
&
personality
,
sizeof
(
personality
));
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
myrank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
mysize
);
cout
<<
myrank
<<
": at "
<<
personality
.
xCoord
<<
" "
<<
personality
.
yCoord
<<
" "
<<
personality
.
zCoord
<<
endl
;
}
#endif
{
Context
ctxt
(
MPI_COMM_WORLD
);
...
...
@@ -176,25 +154,10 @@ int main(int argc, char **argv, char **envp)
cout
<<
" ============================
\n\n
"
;
cout
<<
"
\n
"
;
cout
<<
"<release> "
<<
release
()
<<
" "
<<
TARGET
<<
" </release>"
<<
endl
;
#ifdef SVN_VERSION
cout
<<
"<svn_version> "
<<
SVN_VERSION
<<
" </svn_version>"
<<
endl
;
#endif
// Identify executable name, checksum, size and link date
if
(
getlogin
()
!=
0
)
cout
<<
"<user> "
<<
getlogin
()
<<
" </user>"
<<
endl
;
#if AIX || OSF1
// read filehdr for link time
filehdr
hdr
;
FILE
*
fx
=
fopen
(
argv
[
0
],
"r"
);
if
(
fx
!=
0
)
{
size_t
sz
=
fread
((
void
*
)
&
hdr
,
sizeof
(
filehdr
),
1
,
fx
);
fclose
(
fx
);
string
s
=
ctime
((
time_t
*
)
&
hdr
.
f_timdat
);
cout
<<
"<linktime> "
<<
s
<<
" </linktime>"
<<
endl
;
}
#endif
// Identify platform
{
...
...
@@ -346,15 +309,26 @@ int main(int argc, char **argv, char **envp)
string
inputfilename
(
argv
[
1
]);
string
outputfilename
(
"stdout"
);
ifstream
in
;
int
file_ok
=
0
;
if
(
ctxt
.
onpe0
()
)
{
in
.
open
(
argv
[
1
],
ios
::
in
);
if
(
in
)
if
(
in
)
{
// file was opened on process 0
file_ok
=
1
;
}
}
MPI_Bcast
(
&
file_ok
,
1
,
MPI_INT
,
0
,
MPI_COMM_WORLD
);
if
(
file_ok
)
{
ui
.
processCmds
(
in
,
"[qbox]"
,
echo
);
}
else
{
cout
<<
" qbox: could not open input file "
<<
argv
[
1
]
<<
endl
;
ctxt
.
abort
(
1
);
if
(
ctxt
.
onpe0
()
)
cout
<<
" Could not open input file "
<<
argv
[
1
]
<<
endl
;
}
}
else
if
(
argc
==
4
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment