VirtualBox

Changeset 3311 in kBuild for trunk/SlickEdit/kdev.e


Ignore:
Timestamp:
Mar 9, 2020 10:20:32 PM (5 years ago)
Author:
bird
Message:

Slickedit: Updated to 24.0.x, automating more - no need to copy files anymore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SlickEdit/kdev.e

    r3146 r3311  
    35453545#endif
    35463546
     3547static void kdev_ext_to_lang(_str sExt, _str idLang)
     3548{
     3549#if __VERSION__ >= 21.0 // dunno when exactly.
     3550    _SetExtensionReferTo(sExt, idLang);
     3551#else
     3552    replace_def_data("def-lang-for-ext-" :+ sExt, idLand);
     3553#endif
     3554}
     3555
     3556#if __VERSION__ >= 21.0
     3557
     3558static _str kdev_load_lexer(_str sFilename)
     3559{
     3560    int rc = cload(sFilename);
     3561    if (rc == 0)
     3562        return "";
     3563    return ' Failed to load "' sFilename "': " rc ";";
     3564}
     3565
     3566/** Doesn't seems like there is an API to just load a bunch of profiles, only I
     3567 * could find would load one named profile for a specific language, making it
     3568 * the new profile for that language.  So, a little extra work here.  */
     3569static _str kdev_load_beautifier_profiles(_str sFilename)
     3570{
     3571    _str sRet = '';
     3572    int iStatus = 0;
     3573    auto hXml = _xmlcfg_open(sFilename, iStatus);
     3574    if (hXml >= 0)
     3575    {
     3576        _str asProfiles[];
     3577        iStatus = _xmlcfg_find_simple_array(hXml, "//profile/@n", asProfiles, TREE_ROOT_INDEX, VSXMLCFG_FIND_VALUES, -1);
     3578        _xmlcfg_close(hXml);
     3579
     3580        _str sProfile;
     3581        foreach (sProfile in asProfiles)
     3582        {
     3583            _str asElements[] = split2array(sProfile, '.');
     3584            _str sLangId      = asElements[1];
     3585            _str sProfileName = substr(sProfile, 1 + length(asElements[0])
     3586                                               + 1 + length(asElements[1])
     3587                                               + 1 + length(asElements[2]) + 1);
     3588            //say("sLangId='" sLangId "' sProfileName='" sProfileName "'; ");
     3589            _str sErr = _new_beautifier_config_import_settings(sFilename, sProfileName, sLangId);
     3590            if (sErr != "")
     3591                sRet = ' Failed to load "' sProfileName "' for '" sLangId "' from '" sFilename "': " sRet ";";
     3592        }
     3593    }
     3594    else
     3595        sRet = " Failed to open '" sFilename "': " hXml ";";
     3596    return sRet;
     3597}
     3598
     3599#endif
    35473600
    35483601/**
    35493602 * Loads the standard bird settings.
    35503603 */
    3551 _command void kdev_load_settings()
     3604_command void kdev_load_settings(_str sScriptDir = "")
    35523605{
    35533606    typeless nt1;
     
    35603613    _str sRest;
    35613614    _str sTmp;
     3615    _str sMsg = 'Please restart SlickEdit.';
     3616
     3617    /*
     3618     * Validate script dir argument.
     3619     */
     3620    sScriptDir = _maybe_unquote_filename(sScriptDir);
     3621    if (sScriptDir == "")
     3622    {
     3623        message("Need script dir argument!");
     3624        return;
     3625    }
     3626    if (!file_exists(sScriptDir :+ "/lexer-kmk.cfg.xml"))
     3627    {
     3628        message("Invalid script dir '" sScriptDir "' no lexer-kmk.cfg.xml file found!");
     3629        return;
     3630    }
    35623631
    35633632#if __VERSION__ >= 21.0
    35643633    /*
    3565      * Load the color profile (was lexer).
     3634     * Load the color profiles (was lexer).
    35663635     */
    3567     int rc = cload(_strip_filename(__FILE__, 'N') '/user.vlx');
     3636    sMsg = sMsg :+ kdev_load_lexer(sScriptDir :+  "/lexer-kmk-v2.cfg.xml");
     3637
     3638    /*
     3639     * Load project templates for kBuild.
     3640     */
     3641    int rc = importProjectPacks(sScriptDir :+ "/usrprjtemplates.vpt");
    35683642    if (rc != 0)
    3569         messageNwait('cload of user.vlx failed: ' rc);
     3643        sMsg = sMsg :+ " importProjectPacks(usrprjtemplates.vpt)->" :+ rc :+ ";";
     3644
     3645    /*
     3646     * Load the beautifier profiles.
     3647     */
     3648    sMsg = sMsg :+ kdev_load_beautifier_profiles(sScriptDir :+ "/beautifier-profiles.cfg.xml");
     3649
     3650    /*
     3651     * Load color and select scheme.
     3652     */
     3653    _str sErr = _color_form_import_settings(sScriptDir :+ "/color_profiles.cfg.xml", 'Solarized Dark');
     3654    if (sErr != "")
     3655        sMsg = sMsg :+ " _color_form_import_settings(color_profiles.cfg.xml)->" :+ sErr :+ ";";
     3656    _app_theme('Dark', true);
    35703657#endif
    35713658
     
    36883775        LanguageSettings.setSyntaxIndent(sLangId, 4);
    36893776
    3690         /* C/C++ setup, wrap at column 80 not 64. */
     3777        /* C/C++ setup, fixed comment width of 80 not 64, no max column. */
    36913778# if __VERSION__ >= 21.0
    3692         if (_LangGetPropertyInt32(sLangId, VSLANGPROPNAME_CW_FIXED_RIGHT_COLUMN) < 80)
    3693             _LangSetPropertyInt32(sLangId, VSLANGPROPNAME_CW_FIXED_RIGHT_COLUMN, 80);
     3779        _SetCommentWrapFlags(CW_MAX_RIGHT, false, sLangId);
     3780        _SetCommentWrapFlags(CW_USE_FIXED_WIDTH, true, sLangId);
     3781        if (_LangGetPropertyInt32(sLangId, VSLANGPROPNAME_CW_FIXED_WIDTH_SIZE) < 80)
     3782            _LangSetPropertyInt32(sLangId, VSLANGPROPNAME_CW_FIXED_WIDTH_SIZE, 80);
    36943783# else
    36953784        sTmp = LanguageSettings.getCommentWrapOptions(sLangId);
     
    37363825
    37373826    /* Fix .asm and add .mac, .kmk, .cmd, and .pgsql. */
    3738     replace_def_data("def-lang-for-ext-asm",   'masm');
    3739     replace_def_data("def-lang-for-ext-mac",   'masm');
    3740     replace_def_data("def-lang-for-ext-kmk",   'mak');
    3741     replace_def_data("def-lang-for-ext-cmd",   'bat');
    3742     replace_def_data("def-lang-for-ext-pgsql", 'plsql');
     3827    kdev_ext_to_lang("asm",   'masm');
     3828    kdev_ext_to_lang("mac",   'masm');
     3829    kdev_ext_to_lang("kmk",   'mak');
     3830    kdev_ext_to_lang("cmd",   'bat');
     3831    kdev_ext_to_lang("pgsql", 'plsql');
    37433832
    37443833    /*
     
    38003889     *   */
    38013890
    3802     message("Please restart SlickEdit.")
     3891    message(sMsg)
    38033892}
    38043893
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette