Esempio n. 1
0
File: cgdbrc.c Progetto: denizt/cgdb
int command_set_syntax_type(const char *value)
{
    enum tokenizer_language_support lang;
    struct cgdbrc_config_option option;

    option.option_kind = CGDBRC_SYNTAX;

    if (strcasecmp(value, "c") == 0)
        lang = TOKENIZER_LANGUAGE_C;
    else if (strcasecmp(value, "ada") == 0)
        lang = TOKENIZER_LANGUAGE_ADA;
    else if (strcasecmp(value, "off") == 0)
        lang = TOKENIZER_LANGUAGE_UNKNOWN;

    option.variant.language_support_val = lang;
    if (cgdbrc_set_val(option))
        return 1;
    if_highlight_sviewer(lang);

    return 0;
}
Esempio n. 2
0
int command_set_syntax_type(const char *value)
{
    /* In sources.c */
    extern int sources_syntax_on;

    struct cgdbrc_config_option option;
    enum tokenizer_language_support lang = TOKENIZER_LANGUAGE_UNKNOWN;

    option.option_kind = CGDBRC_SYNTAX;

    if (strcasecmp(value, "c") == 0)
        lang = TOKENIZER_LANGUAGE_C;
    else if (strcasecmp(value, "asm") == 0)
        lang = TOKENIZER_LANGUAGE_ASM;
    else if (strcasecmp(value, "d") == 0)
        lang = TOKENIZER_LANGUAGE_D;
    else if (strcasecmp(value, "go") == 0)
        lang = TOKENIZER_LANGUAGE_GO;
    else if (strcasecmp(value, "ada") == 0)
        lang = TOKENIZER_LANGUAGE_ADA;
    else if (strcasecmp(value, "rust") == 0)
        lang = TOKENIZER_LANGUAGE_RUST;

    /* If caller specified a language or 'on', enable highlighting */
    if (lang != TOKENIZER_LANGUAGE_UNKNOWN || strcasecmp(value, "on") == 0 || strcasecmp(value, "yes") == 0)
        sources_syntax_on = 1;
    else if (strcasecmp(value, "no") == 0 || strcasecmp(value, "off") == 0)
        sources_syntax_on = 0;

    option.variant.language_support_val = lang;
    if (cgdbrc_set_val(option))
        return 1;

    if_highlight_sviewer(lang);
    return 0;
}