Skip to content

Basic Object-Oriented Programming for Embedded Systems

License

Notifications You must be signed in to change notification settings

WholesomeIsland/boopes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

boopes

Basic Object-Oriented Programming for Embedded Systems

What is boopes?

boopes is a OOP framework for the C programming language. it is meant for embedded/small systems like phones, tablets, etc. I created boopes so i didnt need to use GObject. Apperantly it also makes C not look like C.

what does boopes support?

  • single inheritance
  • classes
  • constructors

How Does It Work?

when you create a class, its actually a struct. inheritance creates a super object inside that struct. functions are actually function pointers that you manually fill in the constructor. the this pointer in functions is actually the first argument of that method.

Requirements

you need a c preprocessor that supports ##VA_ARGS because boopes uses this. for embedded systems you can do the peprocessing with a desktop version of gcc, then compile with the compiler for the system your programming for.

Usage

#include "boopes.h"
//the class YourClass derives from object
class(YourClass) inherits_from(object)
//classes can have variables.
int a;
//a method prototype
method_proto(YourClass, MethodReturnType, MethodName);
//the end of the class definition
class_end(YourClass)

constructors need to be crated manually. for example, a constructor for the class above could be

YourClass* YourClass_ctor(int a){
    YourClass* example = new(YourClass);
    //YourMethod is a function that meets the prototype that you declared in the 
    //method_proto above
    example->MethodName = &YourMethod;
    example->a = a;
    return example;
}

this constructor could be called like any normal C function.

YourClass* ex = YourClass_ctor(5);

but to call methods in a class,

call_method(YourCLass, ex, MethodName);

License

boopes is licensed under the GPLv2. the full license should be located in the LICENSE file in the same directory as this one. if you have not received a copy of the license with this software, it can be found at gnu.org/licenses/old-licenses/gpl-2.0.html

About

Basic Object-Oriented Programming for Embedded Systems

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages