Edit

kc3-lang/libxkbcommon/test/utils-text.h

Branch :

  • Show log

    Commit

  • Author : Pierre Le Marre
    Date : 2024-10-09 07:11:13
    Hash : 3ed763c3
    Message : test: Add strip_lines and uncomment to text utils These allow us to store comments in files (especially keymaps), that can then be removed (e.g. to compare with output) or uncommented (e.g. to activate an optional line).

  • test/utils-text.h
  • #include <stdint.h>
    
    char *
    strip_lines(const char *input, size_t input_length, const char *prefix);
    
    char *
    uncomment(const char *input, size_t input_length, const char *prefix);
    
    struct text_line {
        const char *start;
        size_t length;
    };
    
    size_t
    split_lines(const char *input, size_t input_length,
                struct text_line *output, size_t output_length);
    
    size_t
    concat_lines(struct text_line *lines, size_t length,
                 const char *sep, char *output);
    
    size_t
    shuffle_lines(struct text_line *lines, size_t length, char *output);