// DIE's signature file

init("compiler", "Free Pascal");
includeScript("FPC");

function detect(bShowType, bShowVersion, bShowOptions) {
    if (PE.compareEP("E8006E00005589E58B7D0C8B750889F88B5D1029")) {
        sVersion = "0.99.10";
        bDetected = true;
    } else if (PE.compareEP("E8006E00005589E58B7D0C8B750889F88B5D1029", 19)) {
        sVersion = "0.99.10";
        bDetected = true;
    } else if (PE.compareEP("C605........01E8....0000C605........00E8....000050E800000000FF25........55")) {
        sVersion = "1.0.10";
        sOptions = "win32 console";
        bDetected = true;
    } else if (PE.compareEP("C605........00E8....000050E800000000FF25........5589E5")) {
        sVersion = "1.0.10";
        sOptions = "win32 GUI";
        bDetected = true;
    } else if (PE.compareEP("5589E5C605........00E8........5531ED89E0A3........668CD5892D")) {
        sVersion = "1.0.4";
        bDetected = true;
    } else if (PE.compareEP("C605........005589E55356578B7D08893D........8B7D0C893D........8B7D10893D")) {
        sVersion = "1.0.4";
        sOptions = "DLL";
        bDetected = true;
    } else if (PE.compareEP("5589E5C605........00E8........6A0064FF350000000089E0A3")) {
        sVersion = "2.0.0";
        bDetected = true;
    } else if (PE.compareEP("C605........01E874000000C605........00E86800000050E800000000FF25........90")) {
        sVersion = "2.0.0";
        bDetected = true;
    } else if (PE.compareEP("5589E5C605........0168........6AF6E8........50E8")) {
        sVersion = "2.6.0";
        bDetected = true;
    } else if (PE.compareEP("C605..........E8$$$$$$$$5589E5C605..........E8........5531ed89e0A3........668cd5892d........dbe3d9")) {
        sVersion = "1.0.2";
        bDetected = true;
    }
    if (bFPC) {
        var nVersionOffset = PE.findString(nOffset, 0x1024, "FPC ");
        sVersion = PE.getString(nVersionOffset + 4);
        bDetected = true;
        // Gui Lazarus ?
        if (PE.getResourceNameOffset("LAZ_PIC_DIALOG_TEMPLATE") != -1) {
            sOptions = "Lazarus";
        }
    }

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