Welcome, Guest.
Please login or register.
MakeDEC
Forum Login
Login Name: Create a new account
Password:     Forgot password

XBLite Forum    General Boards    XBLite Programming  ›  MakeDEC
Users Browsing Forum
No Members and 1 Guests

MakeDEC  This thread currently has 6,471 views. Print Print Thread
1 Pages 1 Recommend Thread
Carry
June 24, 2013, 2:02am Report to Moderator Report to Moderator
Baby Member
Posts: 36
I've written a program that takes a .DLL library plus related (C/C++) .H header file/s as input, to produce an XBLite .DEC file.

To do this, I use the mcpp preprocessor (BSD license) and ctags tag file generator (GPL license). I  don't think a good result is possible without these extra programs as C language is notoriously hard to parse.

For convenience, I have put link.exe, lib.exe, makedef.exe & checkdec.exe into MakeDEC's program directory. These come from XBLite's installation. So MakeDEC.exe (with it's directory) can run from wherever it's located on your hard drive.

MakeDEC's source code is attached. I think it's fairly straightforward (the hardest part was converting C type structures). If MakeDEC does not work as it should, it usually just needs a small tweak to the code to get it working correctly.

I have tested it on about 5 or so different dll libraries and it usually does a pretty good job. I converted SDL 1.2.15, apparently without any errors (I got all the demo programs working with a new .DEC file.).

When the program doesn't know the details of a type, it puts it into the header section 'XLONG by default'. This seems to work, but it could be worth double checking this section.

So will it work perfectly on all C libraries? Hmm, maybe not. This is the reason why I think this version 1.0 is ready to post and any feedback/input we get will make it even better.

Gary



This post contains attachments; to download them you must login.

Logged Offline
Private Message Private message
XBLiteAdmin
July 4, 2013, 7:45pm Report to Moderator Report to Moderator
Administrator Group
Posts: 44
This could really be a useful and time saving tool, thanks!

You might also remind users that the WinX and adt libraries are also needed.
Logged Offline
Site Site Private Message Private message Reply: 1 - 6
Carry
July 5, 2013, 4:12am Report to Moderator Report to Moderator
Baby Member
Posts: 36
Yes, you will need WinX + adt libraries if you want to recompile MakeDEC's source code. Here is the link to download these:

https://code.google.com/p/xbl-winx/


I find the WinX library is really useful. It greatly simplifies XBLite code as well as making it very concise. People new to XBLite should know about this option right from the start. Maybe it should have a highlighted link (in bold) on XBLite's main website?
Logged Offline
Private Message Private message Reply: 2 - 6
XBLiteAdmin
July 7, 2013, 9:30am Report to Moderator Report to Moderator
Administrator Group
Posts: 44
I found and compiled a C library to test, hash_table, and just about everything worked great.

However, a few bits were missing from some structs, especially when the struct defined
some additional objects/variables at the end of the struct, eg:

typedef struct s_hash_key
{
  unsigned int i_size;
  const void *p_key;
} ght_hash_key_t;

The above struct defines ght_hash_key_t as s_hash_key. It is then immediately used
in the next struct:

typedef struct s_hash_entry
{
  void *p_data;
  struct s_hash_entry *p_next;
  struct s_hash_entry *p_prev;
  struct s_hash_entry *p_older;
  struct s_hash_entry *p_newer;
  ght_hash_key_t key;
} ght_hash_entry_t;

So it would be useful to catch these objects and be able to add something like this:

TYPE ght_hash_key_t = s_hash_key

TYPE ght_hash_entry_t = s_hash_entry

Still, great job on trying to parse a C header file. I've attached the hash_table.dll DLL and ght_hash_table.h header files
for you to look at.

Again, thanks for sharing your program.

D.




This post contains attachments; to download them you must login.

Logged Offline
Site Site Private Message Private message Reply: 3 - 6
Carry
July 10, 2013, 3:00am Report to Moderator Report to Moderator
Baby Member
Posts: 36
I think I've sorted out this issue and 'ght_hash_table.h' converts a lot more nicely now.

Keep the bug reports coming. The more accurate the conversion the better.


Gary



This post contains attachments; to download them you must login.

Logged Offline
Private Message Private message Reply: 4 - 6
the_watchmann
April 29, 2014, 11:08am Report to Moderator Report to Moderator

Baby Member
Posts: 5
Thanks Gary
I am impressed. I sat working on the Sqlite3.h file, manually converting it to a dec file in my spare time as I needed it for an Xbasic program I was writing in Linux. Came across this utility today and tested it and seems to work great. three weeks of converting (without getting finished) in my spare time  and you did it in seconds! Sigh. When will I ever learn. Great utility. Will let you know if I find anything buggy while working on my database.

Thanks again, Gary

David
Logged Offline
Private Message Private message Skype Skype Reply: 5 - 6
Carry
May 2, 2014, 5:36am Report to Moderator Report to Moderator
Baby Member
Posts: 36
Happy to hear that it worked for you Watchmann.

My program relies on freeware utilities written by expert C/C++ programmers (mcpp & ctags). They take away a lot of the pain in converting code to XBLite. Even so, it's still not very straightforward. The problem is that there are so many variations in the way people write their C/C++ headers.

Some conversions, MakeDEC will do a good job, others not good at all, but I think it can still be improved to a point where it's helpful in most cases.
Logged Offline
Private Message Private message Reply: 6 - 6
1 Pages 1 Recommend Thread
Print Print Thread

XBLite Forum    General Boards    XBLite Programming  ›  MakeDEC

Thread Rating
There is currently no rating for this thread