9.5. How to contribute to the kernel

    • PLOOC - The Protected Low-overhead Object Oriented Programming

    • - simplify the management of VM instructions in coding.

    get start -> get start with docker

    Prepare a copy of the Raspberry Pi pico development board, then clone the complete repository and use the bsp/pico-dev project in the repository.

    9.5.3.1. Overview

    PikaScript employs the popular Object-Oriented Programming with ANSI-C, a.ka. OOPC methodology in the design and uses an open-source OOPC template, i.e. PLOOC in the kernel. In addition to the normal structure based class definition, PLOOC introduced a so-called masked-structures. With this trick, members of a class can not only be marked as private, protected and public, but also actually protected as private/protected as other native OO languages do, such as C++, C# etc.

    Here, all members are embraced with private_member(), that means outside the class scope, people cannot see/access those private members, as shown below:

    While, in the dataMemory.h, a macro is added before any includings:

    1. #include "dataMemory.h"
    2. #include "PikaPlatform.h"

    hence, inside those method functions of the class Pool, we can see/access all members listed as private:

    _images/image-20220522025628225.png

    PLOOC is a tool to force a visibility control in the c programming. There are plenty of ways to remove those visibility control in different scales, as shown in the Table 3-1:

    Table 3-1 Summary of visibility controls in PLOOC

    Token (Macro)ScopeUsageDescription
    OOC_DEBUGGlobalDefine it in the project configurationDisable protection for private and protected members. We only use this feature for debugging purpose.
    OOC_CPPGlobalDefine it in the project configurationWhen you including PLOOC enabled header files in any CPP source files, please define this macro to avoid compilation errors.
    \<class_name>_CLASS_IMPLEMENTLocalDefine it at the very beginning of the target c source fileIt marks current c source file as if it is inside the scope of the target class. You can access all class members.
    \<class_name>_CLASS_INHERITLocalDefine it at the very beginning of the target c source fileIt marks current c source file as if it is inside the scope of a derived class of the target class (base class). You can access the protected and public members of the base class.

    NOTE: Please use these Tokens carefully and following the OO design principles.

    9.5.3.3. Rules of using PLOOC inside PikaScript

    • We only use PLOOC inside kernel in principle

    • Contributors are NOT forced to use PLOOC even contribute to the kernel.