Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
c5a0ce90
Commit
c5a0ce90
authored
Dec 07, 2013
by
Baruch Sterin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a new command line option to ABC, -q, same as -c, but without echoing the command
parent
22f9e999
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
15 deletions
+29
-15
src/base/main/main.c
+27
-15
src/base/main/mainUtils.c
+2
-0
No files found.
src/base/main/main.c
View file @
c5a0ce90
...
@@ -89,7 +89,14 @@ int Abc_RealMain( int argc, char * argv[] )
...
@@ -89,7 +89,14 @@ int Abc_RealMain( int argc, char * argv[] )
const
char
*
sOutFile
,
*
sInFile
;
const
char
*
sOutFile
,
*
sInFile
;
char
*
sCommand
;
char
*
sCommand
;
int
fStatus
=
0
;
int
fStatus
=
0
;
int
c
,
fBatch
,
fInitSource
,
fInitRead
,
fFinalWrite
;
int
c
,
fInitSource
,
fInitRead
,
fFinalWrite
;
enum
{
INTERACTIVE
,
// interactive mode
BATCH
,
// batch mode, run a command and quit
BATCH_THEN_INTERACTIVE
,
// run a command, then back to interactive mode
BATCH_QUIET
// as in batch mode, but don't echo the command
}
fBatch
;
// added to detect memory leaks
// added to detect memory leaks
// watch for {,,msvcrtd.dll}*__p__crtBreakAlloc()
// watch for {,,msvcrtd.dll}*__p__crtBreakAlloc()
...
@@ -127,7 +134,7 @@ int Abc_RealMain( int argc, char * argv[] )
...
@@ -127,7 +134,7 @@ int Abc_RealMain( int argc, char * argv[] )
#endif
/* ABC_PYTHON_EMBED */
#endif
/* ABC_PYTHON_EMBED */
// default options
// default options
fBatch
=
0
;
fBatch
=
INTERACTIVE
;
fInitSource
=
1
;
fInitSource
=
1
;
fInitRead
=
0
;
fInitRead
=
0
;
fFinalWrite
=
0
;
fFinalWrite
=
0
;
...
@@ -136,26 +143,31 @@ int Abc_RealMain( int argc, char * argv[] )
...
@@ -136,26 +143,31 @@ int Abc_RealMain( int argc, char * argv[] )
sprintf
(
sWriteCmd
,
"write"
);
sprintf
(
sWriteCmd
,
"write"
);
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
((
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"c:C:hf:F:o:st:T:xb"
))
!=
EOF
)
{
while
((
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"c:
q:
C:hf:F:o:st:T:xb"
))
!=
EOF
)
{
switch
(
c
)
{
switch
(
c
)
{
case
'c'
:
case
'c'
:
strcpy
(
sCommandUsr
,
globalUtilOptarg
);
strcpy
(
sCommandUsr
,
globalUtilOptarg
);
fBatch
=
1
;
fBatch
=
BATCH
;
break
;
case
'q'
:
strcpy
(
sCommandUsr
,
globalUtilOptarg
);
fBatch
=
BATCH_QUIET
;
break
;
break
;
case
'C'
:
case
'C'
:
strcpy
(
sCommandUsr
,
globalUtilOptarg
);
strcpy
(
sCommandUsr
,
globalUtilOptarg
);
fBatch
=
2
;
fBatch
=
BATCH_THEN_INTERACTIVE
;
break
;
break
;
case
'f'
:
case
'f'
:
sprintf
(
sCommandUsr
,
"source %s"
,
globalUtilOptarg
);
sprintf
(
sCommandUsr
,
"source %s"
,
globalUtilOptarg
);
fBatch
=
1
;
fBatch
=
BATCH
;
break
;
break
;
case
'F'
:
case
'F'
:
sprintf
(
sCommandUsr
,
"source -x %s"
,
globalUtilOptarg
);
sprintf
(
sCommandUsr
,
"source -x %s"
,
globalUtilOptarg
);
fBatch
=
1
;
fBatch
=
BATCH
;
break
;
break
;
case
'h'
:
case
'h'
:
...
@@ -183,7 +195,7 @@ int Abc_RealMain( int argc, char * argv[] )
...
@@ -183,7 +195,7 @@ int Abc_RealMain( int argc, char * argv[] )
else
{
else
{
goto
usage
;
goto
usage
;
}
}
fBatch
=
1
;
fBatch
=
BATCH
;
break
;
break
;
case
'T'
:
case
'T'
:
...
@@ -198,13 +210,13 @@ int Abc_RealMain( int argc, char * argv[] )
...
@@ -198,13 +210,13 @@ int Abc_RealMain( int argc, char * argv[] )
else
{
else
{
goto
usage
;
goto
usage
;
}
}
fBatch
=
1
;
fBatch
=
BATCH
;
break
;
break
;
case
'x'
:
case
'x'
:
fFinalWrite
=
0
;
fFinalWrite
=
0
;
fInitRead
=
0
;
fInitRead
=
0
;
fBatch
=
1
;
fBatch
=
BATCH
;
break
;
break
;
case
'b'
:
case
'b'
:
...
@@ -221,10 +233,10 @@ int Abc_RealMain( int argc, char * argv[] )
...
@@ -221,10 +233,10 @@ int Abc_RealMain( int argc, char * argv[] )
extern
Gia_Man_t
*
Gia_ManFromBridge
(
FILE
*
pFile
,
Vec_Int_t
**
pvInit
);
extern
Gia_Man_t
*
Gia_ManFromBridge
(
FILE
*
pFile
,
Vec_Int_t
**
pvInit
);
pAbc
->
pGia
=
Gia_ManFromBridge
(
stdin
,
NULL
);
pAbc
->
pGia
=
Gia_ManFromBridge
(
stdin
,
NULL
);
}
}
else
if
(
fBatch
&&
sCommandUsr
[
0
]
)
else
if
(
fBatch
!=
INTERACTIVE
&&
fBatch
!=
BATCH_QUIET
&&
sCommandUsr
[
0
]
)
Abc_Print
(
1
,
"ABC command line:
\"
%s
\"
.
\n\n
"
,
sCommandUsr
);
Abc_Print
(
1
,
"ABC command line:
\"
%s
\"
.
\n\n
"
,
sCommandUsr
);
if
(
fBatch
)
if
(
fBatch
!=
INTERACTIVE
)
{
{
pAbc
->
fBatchMode
=
1
;
pAbc
->
fBatchMode
=
1
;
...
@@ -267,14 +279,14 @@ int Abc_RealMain( int argc, char * argv[] )
...
@@ -267,14 +279,14 @@ int Abc_RealMain( int argc, char * argv[] )
}
}
}
}
if
(
fBatch
==
2
){
if
(
fBatch
==
BATCH_THEN_INTERACTIVE
){
fBatch
=
0
;
fBatch
=
INTERACTIVE
;
pAbc
->
fBatchMode
=
0
;
pAbc
->
fBatchMode
=
0
;
}
}
}
}
if
(
!
fBatch
)
if
(
fBatch
==
INTERACTIVE
)
{
{
// start interactive mode
// start interactive mode
...
...
src/base/main/mainUtils.c
View file @
c5a0ce90
...
@@ -124,6 +124,8 @@ void Abc_UtilsPrintUsage( Abc_Frame_t * pAbc, char * ProgName )
...
@@ -124,6 +124,8 @@ void Abc_UtilsPrintUsage( Abc_Frame_t * pAbc, char * ProgName )
"usage: %s [-c cmd] [-f script] [-h] [-o file] [-s] [-t type] [-T type] [-x] [-b] [file]
\n
"
,
"usage: %s [-c cmd] [-f script] [-h] [-o file] [-s] [-t type] [-T type] [-x] [-b] [file]
\n
"
,
ProgName
);
ProgName
);
fprintf
(
pAbc
->
Err
,
" -c cmd
\t
execute commands `cmd'
\n
"
);
fprintf
(
pAbc
->
Err
,
" -c cmd
\t
execute commands `cmd'
\n
"
);
fprintf
(
pAbc
->
Err
,
" -q cmd
\t
execute commands `cmd' quietly
\n
"
);
fprintf
(
pAbc
->
Err
,
" -C cmd
\t
execute commands `cmd', then continue in interactive mode
\n
"
);
fprintf
(
pAbc
->
Err
,
" -F script
\t
execute commands from a script file and echo commands
\n
"
);
fprintf
(
pAbc
->
Err
,
" -F script
\t
execute commands from a script file and echo commands
\n
"
);
fprintf
(
pAbc
->
Err
,
" -f script
\t
execute commands from a script file
\n
"
);
fprintf
(
pAbc
->
Err
,
" -f script
\t
execute commands from a script file
\n
"
);
fprintf
(
pAbc
->
Err
,
" -h
\t\t
print the command usage
\n
"
);
fprintf
(
pAbc
->
Err
,
" -h
\t\t
print the command usage
\n
"
);
...
...
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