The Treasure Box Library - GLib alternative

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
j8w344c6
Posts: 184
Joined: Oct 25, 2021 10:18

The Treasure Box Library - GLib alternative

Post by j8w344c6 »

It's the most complete C algorithms and data structures I have ever encountered. It's on par with GLib and unlike GLib, it could be linked statically (The GLib developers explicitly stated GLib shouldn't be linked statically and static linking with GLib is not supported). The problem is it has too many C-specifics and this make translating it to use with FreeBASIC is more difficult. These C-specifics have little or no meaning when using with FreeBASIC. My idea is to strip them from our translated header as much as possible.

The TBOX library is big. I know I don't have enough knowledge to deal with it. Anyone interested to work with me?

You could check the TBOX library here: https://github.com/tboox/tbox

Currently, I'm unable to build it so I'm working on the tbox.h header (src/tbox/tbox.h) only. I don't know if the installed header will differ from the source header or not. It's the case with some libraries. Sometimes the installed header to include in your code is very different from the source form header. Let's hope it's not the case with this library.

TBOX is using some sort of unusual build system I have no experience with. It seems I need to have Lua installed.
j8w344c6
Posts: 184
Joined: Oct 25, 2021 10:18

Re: The Treasure Box Library - GLib alternative

Post by j8w344c6 »

No one interested? Too bad, we don't have anything like GObject Introspection with TBOX library. It will be much easier if we have something like that.
aurelVZAB
Posts: 590
Joined: Jul 02, 2008 14:55
Location: [url]https://aurelsoft.ucoz.com[/url]
Contact:

Re: The Treasure Box Library - GLib alternative

Post by aurelVZAB »

TooBad... for what ?
GLib – 2.0
GLib is a general-purpose, portable utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a mainloop abstraction, and so on.

Version 2.70
Authors GTK Development Team
License LGPL-2.1-or-later
Website https://www.gtk.org
Source https://gitlab.gnome.org/GNOME/glib/
so this is for Linux Gnome ..and i am Windows user ..so not for me
caseih
Posts: 1971
Joined: Feb 26, 2007 5:32

Re: The Treasure Box Library - GLib alternative

Post by caseih »

Glib is actually very portable and compiles just fine on Windows. If you were working in plain C, it's almost useful enough to be in the C standard library.

That said, the OP would probably learn a lot more by re-implementing this amazing treasure box library in pure FB, and have something that would be more useful to FB users. Although FB has its own idiomatic ways of dealing with file i/o, strings, etc, that might not match well with what TBOX does.
freeCish
Posts: 9
Joined: Dec 26, 2021 11:36

Re: The Treasure Box Library - GLib alternative

Post by freeCish »

aurelVZAB wrote:TooBad... for what ?
GLib – 2.0
GLib is a general-purpose, portable utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a mainloop abstraction, and so on.

Version 2.70
Authors GTK Development Team
License LGPL-2.1-or-later
Website https://www.gtk.org
Source https://gitlab.gnome.org/GNOME/glib/
so this is for Linux Gnome ..and i am Windows user ..so not for me
Research a bit more before you put any statements. GLib is cross platform. If you use Geany on Windows then you already have GLib running on Windows since GTK uses GLib and Geany uses GTK. The drawbacks of GLib I already put very clear. This is why I think The Treasure Box Library is really treasure.
freeCish
Posts: 9
Joined: Dec 26, 2021 11:36

Re: The Treasure Box Library - GLib alternative

Post by freeCish »

caseih wrote:That said, the OP would probably learn a lot more by re-implementing this amazing treasure box library in pure FB, and have something that would be more useful to FB users.
Oh nonsense. I know you don't like me but frankly speaking, if any FreeBASIC users interested in stuffs like this then there must be many out there already, isn't it? The problem is so far only VANYA's macro based implement of linked list and Lost Zergling's LZLE to implement useful containers for FB. This pretty much show how interested common FB users to implement a core framework for FB. And you asked me a pretty much newbie in programming and FB to implement stuffs like this? To learn from what? Do you ever think for a second before you click 'Submit'?

I'm calling for co-operators and I don't want you to to everything for me. Please put it clear. If you don't want TBOX and don't want to co-operate please don't make comments like this. It makes very little value.
caseih wrote:Although FB has its own idiomatic ways of dealing with file i/o, strings, etc, that might not match well with what TBOX does.
So does GLib. But GLib was translated. Because it's a crucial part of GTK?
TBOX is a full framework with collections of algorithms, containers,... many things more.
You are underestimating it when comparing it with language's (primitive) core APIs for dealing with file i/o, strings,...
I want to emphasize it again there is absolutely no current production ready implementation of containers for FB. VANYA's macros is incomplete and LZLE is a work in progress. If there is any why I have to translate it from C to use? Can I make it any clearer?
paul doe
Moderator
Posts: 1634
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: The Treasure Box Library - GLib alternative

Post by paul doe »

freeCish wrote:...
I want to emphasize it again there is absolutely no current production ready implementation of containers for FB. VANYA's macros is incomplete and LZLE is a work in progress. If there is any why I have to translate it from C to use? Can I make it any clearer?
Because you didn't searched enough. There are many implementations just hanging around here. In any case, instead of constantly arguing with other members, why don't you start with the simplest containers FreeBasic provides out of the box, arrays? Learn how to manipulate them, resize them, add items to them, etc...
caseih
Posts: 1971
Joined: Feb 26, 2007 5:32

Re: The Treasure Box Library - GLib alternative

Post by caseih »

freeCish wrote:Oh nonsense. I know you don't like me
Nah. I'm just old and crotchety. I don't know anything about you to like or dislike you personally. It's what you say and the way you say things that might raise the hackles. But for the record I have no problem with you wanting to translate the header files for this somewhat obscure (albeit useful) library. But I have no assistance to offer you in this endeavor.
freeCish wrote:So does GLib. But GLib was translated. Because it's a crucial part of GTK?
Correct.
freeCish
Posts: 9
Joined: Dec 26, 2021 11:36

Re: The Treasure Box Library - GLib alternative

Post by freeCish »

paul doe wrote:Because you didn't searched enough. There are many implementations just hanging around here.
I laughed so hard. The forum's search function is broken (useless). What Google gives me also not worth to mention. Accept it. FreeBASIC users are more about immediate result like a simple Win32 API program or a game, but about investing on core infrastructures like this there is almost nothing.
paul doe
Moderator
Posts: 1634
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: The Treasure Box Library - GLib alternative

Post by paul doe »

freeCish wrote:
paul doe wrote:Because you didn't searched enough. There are many implementations just hanging around here.
I laughed so hard. The forum's search function is broken (useless). What Google gives me also not worth to mention. Accept it. FreeBASIC users are more about immediate result like a simple Win32 API program or a game, but about investing on core infrastructures like this there is almost nothing.
Just one of the many results from a 'linked list implementation' search:

The big review

There you'll find more implementations from data structures than you can dream of (among lots of other useful things). And there are many more. I can post a simple set if needed.

Stop arguing.
caseih
Posts: 1971
Joined: Feb 26, 2007 5:32

Re: The Treasure Box Library - GLib alternative

Post by caseih »

freeCish wrote:Accept it.
Yes, please do. Look, people who actually use FB find it incredibly useful and do actual real-world things with it. While it can stand improvements and is being improved, it meets their needs. Accept that. They aren't so concerned about what you think it should be or the things you think are missing. They do not find it so lacking. There are regular contributors who do wrap C libraries as they need them, and others create and contribute class libraries in an ad-hoc fashion as they need them, and that others find useful.

I agree forums suck in so many ways including searching. And I agree it's not always easy to find what others have done. But it is possible to do so, and it's possible to ask much better questions. For example, did you ever think to simply ask if someone can point you at a particular data structure implementation?

Libraries like this one are definitely useful, but when you're learning, it's always worthwhile to have a go at implementing a structure yourself. How about making your own linked list object, for example? Start simple. Or maybe you need a red/black tree. Or a sort function.

Do you understand why many of us are so frustrated with you? Rather than get angry that no one is willing to help you translate header files, why not describe what you're trying to do and whether there are existing class libraries that implement the specific data structures you need? What algorithms are you using? What problems are you trying to solve? Depending on the problem genre, FB may not be an appropriate choice, given the abundance of options these days.
miilvyxg
Posts: 193
Joined: Dec 07, 2021 6:51

Re: The Treasure Box Library - GLib alternative

Post by miilvyxg »

paul doe wrote:
freeCish wrote:
paul doe wrote:Because you didn't searched enough. There are many implementations just hanging around here.
I laughed so hard. The forum's search function is broken (useless). What Google gives me also not worth to mention. Accept it. FreeBASIC users are more about immediate result like a simple Win32 API program or a game, but about investing on core infrastructures like this there is almost nothing.
Just one of the many results from a 'linked list implementation' search:

The big review

There you'll find more implementations from data structures than you can dream of (among lots of other useful things). And there are many more. I can post a simple set if needed.

Stop arguing.
I searched using the phrase 'container freebasic.net' and found nothing. Maybe he's just bad at Google? You seem so harsh on him. What make you hate him that much? I think you should hate me more but I don't really know.
miilvyxg
Posts: 193
Joined: Dec 07, 2021 6:51

Re: The Treasure Box Library - GLib alternative

Post by miilvyxg »

caseih wrote:Libraries like this one are definitely useful, but when you're learning, it's always worthwhile to have a go at implementing a structure yourself. How about making your own linked list object, for example? Start simple. Or maybe you need a red/black tree. Or a sort function.
I prefer to include only one header and have everything, too. Maybe I'm lazy. There are many implementations of various separate containers but no complete collection of containers, isn't it? By collection I mean the user only have to include this header then all of the containers available for him. No need for him to search and pick between various floating implementations of different users on this forum.

Something like this: https://www.javatpoint.com/collections-in-java

Maybe like this in his world he Objective C lover: (Core Foundation framework) https://developer.apple.com/documentati ... on/nsarray

He's not wrong saying there is no complete framework for freebasic if we took Apple Core Foundation as an example of a complete framework.
caseih
Posts: 1971
Joined: Feb 26, 2007 5:32

Re: The Treasure Box Library - GLib alternative

Post by caseih »

miilvyxg wrote:I searched using the phrase 'container freebasic.net' and found nothing.
Yes I wouldn't expect any valid results with those search terms. Especially when you're using a different word than is common. The term, "container" is not the normal term one uses when talking about a data structure. In fact you'll most likely end up with results about docker and linux containers.

You'll need to be much more specific. How about:

site:freebasic.net linked list
site:freebasic.net data structures
caseih
Posts: 1971
Joined: Feb 26, 2007 5:32

Re: The Treasure Box Library - GLib alternative

Post by caseih »

miilvyxg wrote:I prefer to include only one header and have everything, too. Maybe I'm lazy.
Indeed you will find FB disappointing.
Post Reply