Skip to content

Commit 00e03b2

Browse files
not working commit
1 parent e23b5e9 commit 00e03b2

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

src/org/sosy_lab/java_smt/solvers/stp/StpFormulaCreator.java

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,32 @@ public Long makeVariable(Long pType, String pVarName) {
8181

8282
@Override
8383
public FormulaType<?> getFormulaType(Long pFormula) {
84-
System.out.println("I came here.");
84+
// System.out.println("I came here.");
8585
// long type = msat_term_get_type(pFormula);
8686
// return getFormulaTypeFromTermType(type);
87-
return null;
87+
// return null;
88+
Expr formula = new Expr(pFormula, true);
89+
FormulaType<?> result = null;
90+
91+
switch (StpJavaApi.getType(formula)) {
92+
case BOOLEAN_TYPE:
93+
result = FormulaType.BooleanType;
94+
break;
95+
case BITVECTOR_TYPE:
96+
int bvTypeSize = StpJavaApi.getBVLength(formula);
97+
result = FormulaType.getBitvectorTypeWithSize(bvTypeSize);
98+
break;
99+
case ARRAY_TYPE:
100+
// long indexType = StpJavaApi.getIWidth(formula);
101+
// return FormulaType.getArrayType( getFormulaTypeFromTermType());
102+
throw new IllegalArgumentException("//TODO implement this for array formula type ");
103+
case UNKNOWN_TYPE:
104+
throw new IllegalArgumentException("Unknown formula type ");
105+
}
106+
return result;
107+
88108
}
89109

90-
/*
91-
* private FormulaType<?> getFormulaTypeFromTermType(Long type) { // long env = getEnv(); if
92-
* (msat_is_bool_type(env, type)) { return FormulaType.BooleanType; } else if
93-
* (msat_is_integer_type(env, type)) { return FormulaType.IntegerType; } else if
94-
* (msat_is_rational_type(env, type)) { return FormulaType.RationalType; } else if
95-
* (msat_is_bv_type(env, type)) { return
96-
* FormulaType.getBitvectorTypeWithSize(msat_get_bv_type_size(env, type)); } else if
97-
* (msat_is_fp_type(env, type)) { return FormulaType.getFloatingPointType(
98-
* msat_get_fp_type_exp_width(env, type), msat_get_fp_type_mant_width(env, type)); } else if
99-
* (msat_is_fp_roundingmode_type(env, type)) { return FormulaType.FloatingPointRoundingModeType; }
100-
* else if (msat_is_array_type(env, type)) { long indexType = msat_get_array_index_type(env,
101-
* type); long elementType = msat_get_array_element_type(env, type); return
102-
* FormulaType.getArrayType( getFormulaTypeFromTermType(indexType),
103-
* getFormulaTypeFromTermType(elementType)); } throw new
104-
* IllegalArgumentException("Unknown formula type " + msat_type_repr(type)); }
105-
*/
106110
@Override
107111
public <R> R visit(FormulaVisitor<R> pVisitor, Formula pFormula, Long pF) {
108112
// TODO Auto-generated method stub

src/org/sosy_lab/java_smt/solvers/stp/StpFormulaManager.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,15 @@
2323
import org.sosy_lab.common.Appender;
2424
import org.sosy_lab.java_smt.api.BooleanFormula;
2525
import org.sosy_lab.java_smt.basicimpl.AbstractFormulaManager;
26-
import org.sosy_lab.java_smt.basicimpl.FormulaCreator;
2726

2827
public final class StpFormulaManager
2928
extends AbstractFormulaManager<Long, Long, Long, Long> {
3029

3130
@SuppressWarnings("checkstyle:parameternumber")
3231
protected StpFormulaManager(
33-
FormulaCreator pFormulaCreator,
34-
// AbstractUFManager<Long, ?, Long, Long> pFunctionManager,
32+
StpFormulaCreator pFormulaCreator,
3533
StpBooleanFormulaManager pBooleanManager,
36-
// @Nullable IntegerFormulaManager pIntegerManager,
37-
// @Nullable RationalFormulaManager pRationalManager,
3834
@Nullable StpBitvectorFormulaManager pBitvectorManager,
39-
// @Nullable AbstractFloatingPointFormulaManager<Long, Long, Long, Long>
40-
// pFloatingPointManager,
41-
// @Nullable AbstractQuantifiedFormulaManager<Long, Long, Long, Long> pQuantifiedManager,
4235
@Nullable StpArrayFormulaManager pArrayManager) {
4336
super(
4437
pFormulaCreator,
@@ -54,6 +47,7 @@ protected StpFormulaManager(
5447

5548
@Override
5649
public BooleanFormula parse(String pS) throws IllegalArgumentException {
50+
System.out.println("OVER HERE ...");
5751
// TODO Implement parsing from SMTLIB-2 format to bool expr (I can see for BV and not Bool !)
5852
return null;
5953
}

src/org/sosy_lab/java_smt/solvers/stp/StpSolverContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public static StpSolverContext create(
8484
StpArrayFormulaManager arrayFrmMgr = new StpArrayFormulaManager(formulaCreator);
8585
StpBitvectorFormulaManager bitvectorFrmMgr = new StpBitvectorFormulaManager(formulaCreator);
8686

87+
System.out.println("JUST right before");
8788
//Create the main FormulaManager to manage all supported Formula types
8889
StpFormulaManager formulaMgr =
8990
new StpFormulaManager(formulaCreator, booleanFrmMgr, bitvectorFrmMgr, arrayFrmMgr);

0 commit comments

Comments
 (0)