use of com.ibm.j9ddr.CTypeParser in project openj9 by eclipse.
the class CTypeParserTest method testSimplePointer.
@Test
public void testSimplePointer() {
CTypeParser sut = new CTypeParser("int **");
assertEquals("", sut.getPrefix());
assertEquals("int", sut.getCoreType());
assertEquals("**", sut.getSuffix());
}
use of com.ibm.j9ddr.CTypeParser in project openj9 by eclipse.
the class CTypeParserTest method testConstPointers.
@Test
public void testConstPointers() {
CTypeParser sut = new CTypeParser("const int * const");
assertEquals("const ", sut.getPrefix());
assertEquals("int", sut.getCoreType());
assertEquals("* const", sut.getSuffix());
}
use of com.ibm.j9ddr.CTypeParser in project openj9 by eclipse.
the class StructureStubGenerator method writeOffsetInitializer.
private static void writeOffsetInitializer(PrintWriter writer, StructureDescriptor structure) {
Collections.sort(structure.getFields());
for (FieldDescriptor fieldDescriptor : structure.getFields()) {
if (PointerGenerator.getOffsetConstant(fieldDescriptor).equals(fieldDescriptor.getName())) {
String fieldName = fieldDescriptor.getName();
CTypeParser parser = new CTypeParser(fieldDescriptor.getType());
if (parser.getSuffix().contains(":")) {
String bitfieldName = fieldName;
writer.format("\t\t_%s_s_ = 0;%n", bitfieldName);
writer.format("\t\t_%s_b_ = 0;%n", bitfieldName);
} else {
writer.format("\t\t_%sOffset_ = 0;%n", fieldName);
}
}
}
}
use of com.ibm.j9ddr.CTypeParser in project openj9 by eclipse.
the class CTypeParserTest method testBitfieldsFunnySpaces.
@Test
public void testBitfieldsFunnySpaces() {
CTypeParser sut = new CTypeParser("int : 422");
assertEquals("", sut.getPrefix());
assertEquals("int", sut.getCoreType());
assertEquals(":422", sut.getSuffix());
}
use of com.ibm.j9ddr.CTypeParser in project openj9 by eclipse.
the class CTypeParserTest method testBitfields.
@Test
public void testBitfields() {
CTypeParser sut = new CTypeParser("int : 1");
assertEquals("", sut.getPrefix());
assertEquals("int", sut.getCoreType());
assertEquals(":1", sut.getSuffix());
}
Aggregations