screpl.plugins.string.search module

StringSearchApp

TUI - <no result> case

1. Results {""} not found, search string with chat.

<result> case

1. Search results "{string}", %D / Total %D found.
2.  ##. {found line}
3.  ##. {found line}
Feature
  • Search with plain text, prints rich text

pseudocode global variable

  • count: searched count

  • searched_ids: array of string id that contains target

  • searched_string: array of lines containing target

input

  • target : given string

code:

for each string_id:
    char *ptr = get_string_ptr(string_id)
    while (*ptr != 0){
        // make utf-8, remove color code
        length, is_null_end = _strcpy_until_newline(line_buffer, ptr)

        // use KMP search
        // https://www.geeksforgeeks.org/kmp-algorithm-for-pattern-searching/
        found = KMPSearch(line_buffer, target)
        if (found) {
            searched_ids[count] = string_id;
            searched_strings[count] = allocate_line(ptr);
            count ++;
            break;
        }
        if (is_null_end)
            break;
        if (is_null_end):
            break
        else
            ptr += length + 1
    }
screpl.plugins.string.search. KMPSearch ( pattern ) [source]

EUDFuncN - Search string starts with PTR on db_line_buffer

screpl.plugins.string.search. _focus_result ( new_focus ) [source]

EUDFuncN

class screpl.plugins.string.search. StringSearchApp [source]

Bases: screpl.core.application.Application

Application Fields

Application Methods

index

methods

0

screpl.plugins.string.search.StringSearchApp.loop()

1

screpl.plugins.string.search.StringSearchApp.on_chat()

2

screpl.plugins.string.search.StringSearchApp.on_destruct()

3

screpl.core.application.Application.on_init()

4

screpl.core.application.Application.on_resume()

5

screpl.plugins.string.search.StringSearchApp.print()

loop ( self )

AppMethodN (index=0)

on_chat ( self , address )

AppMethodN (index=1)

on_destruct ( self )

AppMethodN (index=2)

print ( self , writer )

AppMethodN (index=5)

static set_return_epd ( return_epd ) [source]