GP-1744_emteere CParser fixes for Macros, pragma(push), reincluded header files, unicode BOM files, #if/defined() on values, and full evaluation of macro expansion. Added output of more information in CParser prefixed with /// comments. Reparsed current standard data archives with correct 64/32 data organizations. Use dtMgr for all new data types in preparation for Data Organization changes.

This commit is contained in:
emteere 2022-04-19 11:08:23 -04:00
parent 026fad27ab
commit 33fe035d84
13 changed files with 1022 additions and 417 deletions

View file

@ -56,7 +56,7 @@ public class AddressEvaluator {
}
else if (obj instanceof Long) {
try {
return af.getDefaultAddressSpace().getAddress(((Long) obj).longValue());
return af.getDefaultAddressSpace().getAddress(((Long) obj).longValue(), true);
}
catch (Exception e) {
// ignore
@ -100,7 +100,7 @@ public class AddressEvaluator {
}
// = must be followed by =, others can be followed
if (tok.equals("=") || tok.equals("!") || tok.equals("<") || tok.equals(">")) {
if ("=!<>|&".contains(tok)) {
lookahead = parser.nextToken();
tok = checkDoubleToken(tok, lookahead);
// if tok is now longer, consumed lookahead
@ -151,6 +151,18 @@ public class AddressEvaluator {
return "!=";
}
break;
case "|":
if (lookahead.equals("|")) {
return "||";
}
break;
case "&":
if (lookahead.equals("&")) {
return "&&";
}
break;
}
return tok;
@ -365,6 +377,14 @@ public class AddressEvaluator {
if (!evaluateOperator(list, Operator.LESSEQUALS, Operator.GREATEREQUALS)) {
return null;
}
if (!evaluateOperator(list, Operator.LOG_AND, null)) {
return null;
}
if (!evaluateOperator(list, Operator.LOG_OR, null)) {
return null;
}
if (list.size() != 1) {
return null;
@ -498,6 +518,18 @@ public class AddressEvaluator {
return diff > 0L ? 1L : 0L;
}
}
else if (op == Operator.LOG_AND) {
if ((v1 instanceof Long) && (v2 instanceof Long)) {
boolean test = (((Long) v1).longValue()) != 0 && (((Long) v2).longValue()) != 0;
return test ? 1L : 0L;
}
}
else if (op == Operator.LOG_OR) {
if ((v1 instanceof Long) && (v2 instanceof Long)) {
boolean test = (((Long) v1).longValue()) != 0 || (((Long) v2).longValue()) != 0;
return test ? 1L : 0L;
}
}
return null;
}
@ -544,6 +576,8 @@ class Operator {
static Operator RIGHTSHIFT = new Operator(">>");
static Operator LEFT_PAREN = new Operator("(");
static Operator RIGHT_PAREN = new Operator(")");
static Operator LOG_OR = new Operator("||");
static Operator LOG_AND = new Operator("&&");
static Operator EQUALS = new Operator("==");
static Operator NOTEQUALS = new Operator("!=");
static Operator LESS = new Operator("<");
@ -622,6 +656,12 @@ class Operator {
else if (tok.equals(">=")) {
return GREATEREQUALS;
}
else if (tok.equals("||")) {
return LOG_OR;
}
else if (tok.equals("&&")) {
return LOG_AND;
}
return null;
}
}