Skip to content

Commit

Permalink
update version no
Browse files Browse the repository at this point in the history
  • Loading branch information
hollacs committed Mar 15, 2024
1 parent f851791 commit c184c53
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion inc/moduleconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* to add multiple entries.
*/
#define MODULE_NAME "Object-Orientation"
#define MODULE_VERSION "1.0.0"
#define MODULE_VERSION "1.1.0"
#define MODULE_AUTHOR "Hon Fai & holla"
#define MODULE_URL ""
#define MODULE_LOGTAG "OO"
Expand Down
2 changes: 1 addition & 1 deletion inc/oo_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <cstdint>
#include <amtl/am-cxx.h>

KE_CONSTEXPR int OO_VERSION = 100;
KE_CONSTEXPR int OO_VERSION = 110;

namespace oo
{
Expand Down
6 changes: 3 additions & 3 deletions tests/include/oo.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#pragma loadlib oo
#endif

#define OO_VERSION 1.0.0
#define OO_VERSION_NUM 100
stock const OO_VERSION_STR[] = "1.0.0";
#define OO_VERSION 1.1.0
#define OO_VERSION_NUM 110
stock const OO_VERSION_STR[] = "1.1.0";

#define @null any:0 // null object
#define @this oo_this() // this object
Expand Down
28 changes: 14 additions & 14 deletions tests/oo_animal.sma
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public oo_init()
oo_var(cl, "name", 32); // A attribute that stores the name of the animal

// A constructor that takes the name and the age of the animal
oo_ctor(cl, "Ctor", @str{name}, @int{age});
oo_ctor(cl, "Ctor", @str(name), @int(age));

// A destructor of the animal
oo_dtor(cl, "Dtor");

// A function that returns the sound of the animal
oo_mthd(cl, "MakeSound", @stref{msg}, @int{len});
oo_mthd(cl, "MakeSound", @stref(msg), @int(len));

// A function that returns the number of legs of the animal
oo_mthd(cl, "GetLegs");
Expand All @@ -37,10 +37,10 @@ public oo_init()
new cl[] = "Dog";

// A constructor that calls the base class constructor with the name "Dog"
oo_ctor(cl, "Ctor", @int{age});
oo_ctor(cl, "Ctor", @int(age));

// An override function that returns the sound of a dog
oo_mthd(cl, "MakeSound", @stref{msg}, @int{len});
oo_mthd(cl, "MakeSound", @stref(msg), @int(len));

// An override function that returns the number of legs of a dog
oo_mthd(cl, "GetLegs");
Expand All @@ -52,10 +52,10 @@ public oo_init()
new cl[] = "Cat";

// A constructor that calls the base class constructor with the name "Cat"
oo_ctor(cl, "Ctor", @int{age});
oo_ctor(cl, "Ctor", @int(age));

// An override function that returns the sound of a cat
oo_mthd(cl, "MakeSound", @stref{msg}, @int{len});
oo_mthd(cl, "MakeSound", @stref(msg), @int(len));

// An override function that returns the number of legs of a cat
oo_mthd(cl, "GetLegs");
Expand All @@ -67,10 +67,10 @@ public oo_init()
new cl[] = "Bird";

// A constructor that calls the base class constructor with the name "Bird"
oo_ctor(cl, "Ctor", @int{age});
oo_ctor(cl, "Ctor", @int(age));

// An override function that returns the sound of a bird
oo_mthd(cl, "MakeSound", @stref{msg}, @int{len});
oo_mthd(cl, "MakeSound", @stref(msg), @int(len));

// An override function that returns the number of legs of a bird
oo_mthd(cl, "GetLegs");
Expand All @@ -82,10 +82,10 @@ public oo_init()
new cl[] = "Snake";

// A constructor that calls the base class constructor with the name "Snake"
oo_ctor(cl, "Ctor", @int{age});
oo_ctor(cl, "Ctor", @int(age));

// An override function that returns the sound of a snake
oo_mthd(cl, "MakeSound", @stref{msg}, @int{len});
oo_mthd(cl, "MakeSound", @stref(msg), @int(len));

// An override function that returns the number of legs of a snake
oo_mthd(cl, "GetLegs");
Expand Down Expand Up @@ -226,19 +226,19 @@ public main()
server_print("Class Dog %s a subclass of Animal", oo_subclass_of("Dog", "Animal") ? "IS" : "IS NOT");
server_print("Class Animal %s a subclass of Cat", oo_subclass_of("Animal", "Cat") ? "IS" : "IS NOT");

server_print("Class Bird %s exists", oo_class_exists("Bird") ? "IS" : "IS NOT");
server_print("Class Fish %s exists", oo_class_exists("Fish") ? "IS" : "IS NOT");
server_print("Class Bird %s", oo_class_exists("Bird") ? "EXISTS" : "DOES NOT EXIST");
server_print("Class Fish %s", oo_class_exists("Fish") ? "EXISTS" : "DOES NOT EXIST");

new class[32];
oo_get_classname(animals[0], class, charsmax(class));
server_print("Object #%d's classname is %s", animals[0], class);

server_print("Object #%d %s exists", animals[0], oo_object_exists(animals[0]) ? "IS" : "IS NOT");
server_print("Object #%d %s", animals[0], oo_object_exists(animals[0]) ? "EXISTS" : "DOES NOT EXIST");

for (new i = 0; i < 5; i++)
{
oo_delete(animals[i]); // Delete each animal objects
}

server_print("Object #%d %s exists", animals[0], oo_object_exists(animals[0]) ? "IS" : "IS NOT");
server_print("Object #%d %s", animals[0], oo_object_exists(animals[0]) ? "EXISTS" : "DOES NOT EXIST");
}

0 comments on commit c184c53

Please sign in to comment.