// Detect It Easy: detection rule file format
init("compiler", "Delphi");

function detect(bShowType, bShowVersion, bShowOptions) {
    var nSection = MACH.getSectionNumber("__rodata");
    if (nSection != -1) {
        var nSectionOffset = MACH.getSectionFileOffset(nSection);
        var nSectionSize = MACH.getSectionFileSize(nSection);

        var nOffset = MACH.findSignature(nSectionOffset, nSectionSize, "'TObject'");
        if (nOffset != -1) {
            sName = "Embarcadero Delphi";
            sVersion = "XE2-XE6"
            bDetected = true;
        }
    }

    _setLang("Delphi", bDetected);
    return result(bShowType, bShowVersion, bShowOptions);
}