Search in sources :

Example 11 with CTypeParser

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());
}
Also used : CTypeParser(com.ibm.j9ddr.CTypeParser) Test(org.junit.Test)

Example 12 with CTypeParser

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());
}
Also used : CTypeParser(com.ibm.j9ddr.CTypeParser) Test(org.junit.Test)

Example 13 with CTypeParser

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);
            }
        }
    }
}
Also used : CTypeParser(com.ibm.j9ddr.CTypeParser) FieldDescriptor(com.ibm.j9ddr.StructureReader.FieldDescriptor)

Example 14 with CTypeParser

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());
}
Also used : CTypeParser(com.ibm.j9ddr.CTypeParser) Test(org.junit.Test)

Example 15 with CTypeParser

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());
}
Also used : CTypeParser(com.ibm.j9ddr.CTypeParser) Test(org.junit.Test)

Aggregations

CTypeParser (com.ibm.j9ddr.CTypeParser)20 Test (org.junit.Test)16 FieldDescriptor (com.ibm.j9ddr.StructureReader.FieldDescriptor)1 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)1