void OSBNodeElement::read(const std::string &typeName) { OSG_OSB_LOG(("OSBNodeElement::read [%s]\n", typeName.c_str())); BinaryReadHandler *rh = editRoot()->getReadHandler(); UInt8 fcPtrType; UInt16 version; rh->getValue(fcPtrType); rh->getValue(version ); OSG_OSB_LOG(("OSBNodeElement::read: version: [%u]\n", version)); if(fcPtrType != OSBCommonElement::FCPtrNode) { FFATAL(("OSBNodeElement::read: fcPtrType has unexpected value.\n")); skipFields(); return; } NodeUnrecPtr node = Node::create(); setContainer(node); readFields("'volume'", ""); }
void OSBGenericElement::read(const std::string &typeName) { OSG_OSB_LOG(("OSBGenericElement::read [%s]\n", typeName.c_str())); BinaryReadHandler *rh = editRoot()->getReadHandler(); UInt8 ptrTypeTag; UInt16 version; rh->getValue(ptrTypeTag); rh->getValue(version ); OSG_OSB_LOG(("OSBGenericElement::read: version: [%u] ptrTypeTag [%u]\n", version, ptrTypeTag)); setContainer(FieldContainerUnrecPtr( FieldContainerFactory::the()->createContainer(typeName.c_str()))); if(getContainer() == NULL) { FWARNING(("OSBGenericElement::read: Skipping unknown " "FieldContainer [%s].\n", typeName.c_str())); skipFields(); setContainer(FieldContainerUnrecPtr(createReplacementFC(ptrTypeTag))); return; } readFields("", ""); }
int main(int argc, char * argv[]) { // Verify the File if(argc != 2) { fprintf(stderr, "Invalid number of arguments. Exiting program\n"); return 1; } f1 = fopen(argv[1], "r"); if(!f1) { fprintf(stderr, "File could not be opened successfully. Exiting program."); return 1; } int readX = 0; if((fgetc(f1) != 0xCA) || (fgetc(f1) != 0xFE) || (fgetc(f1) != 0xBA) || (fgetc(f1) != 0xBE)) { fprintf(stderr, "File not a class file. Exiting program\n"); return 1; } //Skip minor_version and major_version for(j = 0; j < 4; j++) { fgetc(f1); } readX = fgetc(f1); loopCount = fgetc(f1); loopCount |= (readX << 8); loopCount -= 1; int constArray[loopCount + 1]; int opcodeArray[JVM_OPC_MAX] = {0}; for(i = 1; i < loopCount + 1; i++) { constArray[i] = 0; } decodeConstantPool(constArray, readX, loopCount); skipInterfaces(readX); skipFields(); findOpcodes(constArray, opcodeArray); int garbageFlag = 0; if(opcodeArray[0] == 0) { garbageFlag = 1; } char * opcodeNames[JVM_OPC_MAX]; initializeOpcodeNames(opcodeNames); if(garbageFlag) { opcodeArray[0] = 0; } for(i = 0; i < JVM_OPC_MAX; i++) { if(opcodeArray[i] != 0) { printf("%s: %d\n", opcodeNames[i], opcodeArray[i]); } } return 0; }