RisohEditor and Automation

To Top Page | Previous Page | Next Page


Introduction of programming language EGA

RisohEditor can perform automated processing using EGA. EGA is a compact programming language I developed. You can use various useful functions by using EGA with RisohEditor.

There is the EGA folder in RisohEditor. The EGA sample programs and the manual are included here.

Censorship

Censorship may be enforced for the purpose of stabilizing the national polity in small countries with unstable political conditions. With EGA, it is possible to automatically censor the resource data opened in the resource editor by words. Please open the sample program "Censorship.ega" with a text editor to see it.

@ Censorship.ega

set(ForbiddenWords, { "開く", "編集", "酒" });

set(res, RES_search());
foreach(item, res,
    (
        set(bin, RES_get_binary(at(item, 0), at(item, 1), at(item, 2))),
        foreach(text, ForbiddenWords,
            (
                if(or(!=(find(bin, text), -(1)),
                      !=(find(bin, u16fromu8(text)), -(1))),
                    (
                        println(
                            cat(
                                "Forbidden Word '",
                                text,
                                "' found in { ",
                                str(at(item, 0)), ", ",
                                str(at(item, 1)), ", ",
                                str(at(item, 2)),
                                " }."
                            )
                        )
                    )
                )
            )
        )
    )
);

The variable ForbiddenWords is an array containing forbidden words. The RES_search function and RES_get_binary function can be used to get the resource data currently open in RisohEditor. With the foreach function, you can enumerate the elements of the array. The find function searches for a string, and the matching resource is output by using the println function.

[Example]

This is a great relief to the authorities.

Kill the Japanese resources

Let's look at the following program. The sample program "RES_delete.ega" deletes all Japanese resources.

@ Delete Japanese (1041) resources all.
RES_delete(0, 0, 1041);

The resource is deleted by specifying Japanese (1041) in the RES_delete function. I think it is a convenient function for people who dislike Japan personally or people who dislike Japan ethnically.

Resource replication

The sample program "RES_clone_by_lang.ega" creates Japanese resources from English resources.

@ Clone English (1033) resources as Japanese (1041) resources.
RES_clone_by_lang(0, 0, 1033, 1041);

The sample program "NeutralToEnglish.ega" converts neutral language resources into English resources.

@ Clone all Neutral (0) resources to English (1033) resources.
RES_clone_by_lang(0, 0, 0, 1033);

@ Erase all Neutral (0) resources.
RES_delete(0, 0, 0);

Factorials

EGA can calculate the factorials of small natural numbers ("fact.ega").

define(fact, do(set(prod, 1), for(i, 2, n, set(prod, *(prod, i)))));

for(k, 1, 12, (
        set(n, k),
        fact,
        println("n = ", n, ": fact == ", prod)
    )
)

[Example]


To Top Page | Previous Page | Next Page

inserted by FC2 system