Basic Object-Oriented Programming for Embedded Systems
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.
- single inheritance
- classes
- constructors
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.
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.
#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);
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