[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Anyone interested in a fork with custom object-oriented e
From: |
Míguel |
Subject: |
[Tinycc-devel] Anyone interested in a fork with custom object-oriented extensions? |
Date: |
Fri, 12 Mar 2010 00:47:07 +0100 |
Hi!
I was thinking on writing (or modifying) a C-like compiler with some
custom object-oriented extension (different than C++ ones) and some
other ideas.
But, to be honest, I don't have enough coding level to write or modify
a compiler.
So I though perhaps someone is interested in something similar to what
I'm thinking, and this could be a good place to find people like that.
I'll show you what are my ideas with code examples, in case anyone is
interested about it. It's only a sample, more additions are probably
needed.
As none of you are probably interested, let me apologize for posting
it, but I had to try luck!
----------------------------------------------
Classes Declaration
---------------------
class myclass {
property {
// Private properties
private long e, f;
private word g, h;
// Read-write properties.
public string text1, text2;
// Read-write property with property set.
public string text3(nvalue) {
text3 = nvalue;
// Additional needed code here...
}
// Read-only property.
readable string text4;
// Write-only property.
writable text5;
// Write-only string with property set.
writable string text6(nvalue) {
text6 = nvalue;
// Additional needed code here...
}
}
event {
void keydown(byte keycode, byte mods);
void click(dword x, dword y, byte button);
}
// Operators (not all of them are show in this example).
myclass* operator=(myclass* right) {
this.g = 10;
}
myclass* operator=(string* right);
myclass* operator+(myclass* right);
myclass* operator+(dword* right);
myclass* operator++();
myclass* operator*(myclass* right);
// Private method.
private void method1(long param1) {
// Method code...
return param1;
}
// Public method.
public byte setfocus(short param2) {
// Method code...
}
// Class constructor.
init myclass(long i = 10, long j = 13) {
// Constructor code...
}
// Class destructor.
kill myclass() {
// Destructor code...
}
}
Variable declaration and initialization
-----------------------------------------
long* var1, var3, var10; // All of them are pointers.
// Multiple initialization of objects.
mytype button1, button2, button3 {
width = 100;
height = 20;
enabled = 0;
}
Behavior of pointers
----------------------
Pointers behave the same way as normal variables, unlike C.
The term to the right of the equal decides what is assigned to a pointer.
So, in the following example, x is the content of x, *x is the address
contained by x and **x is the content of x.
In other hand, z is the content of z, *z is the address contained by
z, **z is the address contained by *z, and ***z is the address of z.
long* x, y;
long** z;
x = y; // Assign to x the content of y.
x = *y; // Point *x to the address contained in y.
z = y; // Assign z the content of y.
z = *y; // Point *z to the address contained in y.
z = **y; // Point **z to the address of y.
y = z; // Assign to y the content of z.
y = *z; // Point *y to the address
- [Tinycc-devel] Anyone interested in a fork with custom object-oriented extensions?,
Míguel <=