Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 900 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 6 1 2 3 4 5 6
Re: Lite Foundation - A powerful Lite-C library [Re: Quad] #368115
04/21/11 15:31
04/21/11 15:31
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Ok, JustSid, so here is another heretic question. From a technical point of view I think your work is very interesting. On the other hand I don't get your concept of using this. Very roughly speaking you bind functions to structs so they more or less appear as methods. That goes into an oop direction. However, you do not provide inheritance (at least not without a workaround), no polymorphy and no encapsulation. That makes a score of 0.5 out of 3 on the oop properties scale... tongue

So the question is: why should I use this complicated stuff instead of just using the c++ sdk?


Always learn from history, to be sure you make the same mistakes again...
Re: Lite Foundation - A powerful Lite-C library [Re: Uhrwerk] #368118
04/21/11 15:53
04/21/11 15:53
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline OP
Expert
WretchedSid  Offline OP
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Uhrwerk
On the other hand I don't get your concept of using this. Very roughly speaking you bind functions to structs so they more or less appear as methods. That goes into an oop direction. However, you do not provide inheritance (at least not without a workaround), no polymorphy and no encapsulation.

I don't see why adding a line of code is a workaround to create inheritance, I mean, even in Java and C++ you have to provide the name of the class you want to subclass. So I don't see why inheritance is a huge problem (including that I just updated the runtime) but maybe I miss a point?
About polymorphism, like I already mentioned in my answer to Schubido, it IS possible and done through protocols. I see that its not the most convenient way and I'm open for any suggestions about this because I find this part a bit dirty too, but it works and since the last update it also works nicely with inheritance.

You are right about encapsulation, however, you can still move your struct into the .c file and thus encapsulate the structs members from the user (plus if you are really crazy you can go ahead and build a public struct that has the same size but not all members but padding stuff in between).
This is where it hits the language limitations really bad and I can't offer any solution for this, but like in C++: Don't use classes as containers can be used as rule of thumb for Lite Foundation classes too and it works just fine.

Quote:
So the question is: why should I use this complicated stuff instead of just using the c++ sdk?

Now that is a good question and the answer is the same as I gave ratchet for his C# question; If you can work with C++, work with it!
For me thats not an option, I hate C++, I hate the memory model of C++ etc. This is the same with any other wrapper for language xyz; If you like the language and can work with it, do it!

However, if you are not sure if you like C++ and are used to C, you can give Lite Foundation a try and might fall in love with its reference counting environment and this other "complicated" stuff laugh


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Lite Foundation - A powerful Lite-C library [Re: WretchedSid] #368228
04/23/11 01:00
04/23/11 01:00
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
I'm following your project and the discussions about it with big interest.

I found a grafik about certain 'styles' of programming:

Unfortunately the english wikipedia article http://en.wikipedia.org/wiki/Component-based_software_engineering doesn't use the same classification in four levels.
Question:
Where would you place Lite-C and where Lite-C Foundation?
Or doesn't the scheme of the grafik make any sense?

Re: Lite Foundation - A powerful Lite-C library [Re: Pappenheimer] #368232
04/23/11 04:52
04/23/11 04:52
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
*wishes i could read the german in the graphic* frown

Re: Lite Foundation - A powerful Lite-C library [Re: lostclimate] #368235
04/23/11 07:34
04/23/11 07:34
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Lostclimate, is that a joke? grin
I can try to translate the pic for you:
Abstraktion -> Abstraction
Komponentenbasierte Programmierung -> component-based software engineering
Distributed Object Computing -> Distributed Object Computing
Objektorientierte Programmierung -> Object-Oriented Programming
Procedurale Programmierung -> Procedural Programming
z.B. -> for example
CCM -> CCM
CORBA -> CORBA
C++ -> C++
C -> C

Maybe now you know why I asked you whether or not it was a joke... tongue

Justsid, I like the idea of having classes in LiteC a lot. But I won't get around to trying them out any time soon. It doesn't make sense to implement them in my game because it's progressed too far, and I want to switch to C++ when this game is finished. So currently I don't have the need for such structures, but the approach is very interesting.

Last edited by Germanunkol; 04/23/11 07:36.

~"I never let school interfere with my education"~
-Mark Twain
Re: Lite Foundation - A powerful Lite-C library [Re: Pappenheimer] #368299
04/23/11 21:39
04/23/11 21:39
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline OP
Expert
WretchedSid  Offline OP
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Pappenheimer
Question:
Where would you place Lite-C and where Lite-C Foundation?

So first of all, its Lite Foundation and not Lite-C Foundation as its not an exclusive Lite-C project wink [/wise guy]

To answer the question, Lite-C as being a subset of C89 is placed in the "Procedural programming". Lite Foundation tries to bring C and thus also Lite-C to the next "level", the "object oriented programming".
This is the work made by the Lite Foundation runtime as it allows you to define classes and create instances so you have objects that you can work with, rather than just functions and a global set of variables.

However, if you count the whole acknex foobar to Lite-C, then Lite-C is half procedural and half object oriented. The whole ENTITY stuff and such with its functions like ent_create() ent_do_something() etc is completely object oriented while the normal program flow is usual procedural.


Its btw time for a new update, this time its just the default library but I think its pretty awesome as it brings two new objects and proves Uhrwerks "no polymorphism" wrong.

The first new object is the LFSetRef, a basic hash table implementation that works based on prime numbers and such. As with every hash table, its pretty hard to iterate through it and at this place the second new objects kicks in; LFEnumeratorRef.
The LFEnumeratorRef is a wrapper class to allow enumerating of _every_ collection class, read: When I add an array class, it can be enumerated in the very same way! Likewise, if you create an array class, it also works with your arrays the very same way.

Now some of you will say "this is garbage, its impossible unless you restrict the way collection classes are build" and I can tell you "its true and you are free to build you collection class in whatever way you want".
Like I said, the LFEnumeratorRef class is a wrapper, it wraps the LFEnumerator protocol. So for every class that wants to be enumerated using a LFEnumeratorRef object, the class must implement the protocol and one simple function: "give me the next n objects".

Here is a short example to show how easy the LFEnumeratorRef is:
Code:
LFEnumeratorRef enumerator = LFEnumeratorCreate(someObject);
LFTypeRef object;
 while((object = LFEnumeratorNextObject(enumerator)))
 {
 	// Do something with the object
 }




The release also contains two bug fixes; The LFString class used a local variable called "result" in the hash and equal functions, the Lite-C compiler never said anything about this and compiled the code just fine, but the result of the functions were pretty random.
It took me a while to figure out why my LFSetRef test scripts never worked in Lite-C (they make heavy use of both functions).


The download link is still the same; http://www.widerwille.com/litefoundation/litefoundation.zip


Time to work on the promised demo, it will sadly require A7/A8 pro or ANet, but I guess most users here have both of it? Oh and no, its not a multiplayer demo.
EDIT: Ah darn, looks like I first need to write a class that allows HTTP requests other than just stupid HTTP POST... Oh well...
In the meantime; any heretic questions left? tongue


EDIT: I made a horrible mistake while copy'n'pasting some of the LFSetRef's code around to get it working with the Lite-C compiler, calling LFCopy() with an LFSetRef as receiver will fail in a way that the buckets aren't copied! This will certainly crash the program when you the function so please; Redownload Lite Foundation!

Last edited by JustSid; 04/23/11 22:53.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Lite Foundation - A powerful Lite-C library [Re: WretchedSid] #368310
04/23/11 23:49
04/23/11 23:49
Joined: Jan 2011
Posts: 122
GUILIN , CHINA
tzw Offline
Member
tzw  Offline
Member

Joined: Jan 2011
Posts: 122
GUILIN , CHINA
i've tried it . very useful lib.thx


Full of my eyes are class struggles.....
Re: Lite Foundation - A powerful Lite-C library [Re: tzw] #368664
04/27/11 13:15
04/27/11 13:15
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline OP
Expert
WretchedSid  Offline OP
Expert

Joined: Apr 2007
Posts: 3,751
Canada
You are welcome laugh


Btw, the next version is ready, it includes the new LFArray class which is, surprise, a class that maintains a ordered collection of objects.
The problem with arrays is; They are slow! Random deletion and insertion has, in the worst case, the effect that the functions needs to iterate through the whole array multiple times. It also needs to check its content for double entries and such.

I have two screenshots from my profiler to demonstrate the difference between the LFArray class and the LFSet class:

Inserting and deleting 10024 random items in and from a LFArray takes around 1970 ms!


Inserting and deleting the same amount of items from a LFSet takes just 13 ms!

Those numbers are from a very old iMac with a 2Ghz CPU, the test binary was built as x86 Intel binary with no compiler optimizations.


You can download the new version using the links from the previous posts.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Lite Foundation - A powerful Lite-C library [Re: WretchedSid] #368671
04/27/11 14:38
04/27/11 14:38
Joined: Jan 2011
Posts: 122
GUILIN , CHINA
tzw Offline
Member
tzw  Offline
Member

Joined: Jan 2011
Posts: 122
GUILIN , CHINA
hi justsid. is the lib support "this"? if yes , how to emulate this feature? sorry for my eng


Full of my eyes are class struggles.....
Re: Lite Foundation - A powerful Lite-C library [Re: tzw] #368698
04/27/11 17:32
04/27/11 17:32
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline OP
Expert
WretchedSid  Offline OP
Expert

Joined: Apr 2007
Posts: 3,751
Canada
No, there is no workaround for 'this'.
In my implementations, the first argument is used as the receiver and for the sake fo simplicity I would suggest that others adopt this convention too.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Page 2 of 6 1 2 3 4 5 6

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1