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
f61b5d8c
Commit
f61b5d8c
authored
Nov 03, 2017
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Supporting XOR in EQN parser.
parent
e21052df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
src/misc/parse/parseEqn.c
+9
-2
No files found.
src/misc/parse/parseEqn.c
View file @
f61b5d8c
...
...
@@ -32,11 +32,13 @@ ABC_NAMESPACE_IMPL_START
#define PARSE_EQN_SYM_CONST1 '1' // constant 1
#define PARSE_EQN_SYM_NEG '!' // negation before the variable
#define PARSE_EQN_SYM_AND '*' // logic AND
#define PARSE_EQN_SYM_XOR '^' // logic XOR
#define PARSE_EQN_SYM_OR '+' // logic OR
// the list of opcodes (also specifying operation precedence)
#define PARSE_EQN_OPER_NEG 10 // negation
#define PARSE_EQN_OPER_AND 9 // logic AND
#define PARSE_EQN_OPER_XOR 8 // logic XOR
#define PARSE_EQN_OPER_OR 7 // logic OR
#define PARSE_EQN_OPER_MARK 1 // OpStack token standing for an opening parenthesis
...
...
@@ -138,6 +140,7 @@ Hop_Obj_t * Parse_FormulaParserEqn( FILE * pOutput, char * pFormInit, Vec_Ptr_t
Parse_StackOpPush
(
pStackOp
,
PARSE_EQN_OPER_NEG
);
break
;
case
PARSE_EQN_SYM_AND
:
case
PARSE_EQN_SYM_XOR
:
case
PARSE_EQN_SYM_OR
:
if
(
Flag
!=
PARSE_EQN_FLAG_VAR
)
{
...
...
@@ -147,8 +150,10 @@ Hop_Obj_t * Parse_FormulaParserEqn( FILE * pOutput, char * pFormInit, Vec_Ptr_t
}
if
(
*
pTemp
==
PARSE_EQN_SYM_AND
)
Parse_StackOpPush
(
pStackOp
,
PARSE_EQN_OPER_AND
);
else
//
if ( *pTemp == PARSE_EQN_SYM_OR )
else
if
(
*
pTemp
==
PARSE_EQN_SYM_OR
)
Parse_StackOpPush
(
pStackOp
,
PARSE_EQN_OPER_OR
);
else
//if ( *pTemp == PARSE_EQN_SYM_XOR )
Parse_StackOpPush
(
pStackOp
,
PARSE_EQN_OPER_XOR
);
Flag
=
PARSE_EQN_FLAG_OPER
;
break
;
case
PARSE_EQN_SYM_OPEN
:
...
...
@@ -204,7 +209,7 @@ Hop_Obj_t * Parse_FormulaParserEqn( FILE * pOutput, char * pFormInit, Vec_Ptr_t
// scan the next name
for
(
i
=
0
;
pTemp
[
i
]
&&
pTemp
[
i
]
!=
' '
&&
pTemp
[
i
]
!=
'\t'
&&
pTemp
[
i
]
!=
'\r'
&&
pTemp
[
i
]
!=
'\n'
&&
pTemp
[
i
]
!=
PARSE_EQN_SYM_AND
&&
pTemp
[
i
]
!=
PARSE_EQN_SYM_OR
&&
pTemp
[
i
]
!=
PARSE_EQN_SYM_CLOSE
;
i
++
)
pTemp
[
i
]
!=
PARSE_EQN_SYM_AND
&&
pTemp
[
i
]
!=
PARSE_EQN_SYM_OR
&&
pTemp
[
i
]
!=
PARSE_EQN_SYM_
XOR
&&
pTemp
[
i
]
!=
PARSE_EQN_SYM_
CLOSE
;
i
++
)
{
if
(
pTemp
[
i
]
==
PARSE_EQN_SYM_NEG
||
pTemp
[
i
]
==
PARSE_EQN_SYM_OPEN
)
{
...
...
@@ -338,6 +343,8 @@ Hop_Obj_t * Parse_ParserPerformTopOp( Hop_Man_t * pMan, Parse_StackFn_t * pStack
gFunc
=
Hop_And
(
pMan
,
gArg1
,
gArg2
);
else
if
(
Oper
==
PARSE_EQN_OPER_OR
)
gFunc
=
Hop_Or
(
pMan
,
gArg1
,
gArg2
);
else
if
(
Oper
==
PARSE_EQN_OPER_XOR
)
gFunc
=
Hop_Exor
(
pMan
,
gArg1
,
gArg2
);
else
return
NULL
;
// Cudd_Ref( gFunc );
...
...
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