Playing with HMG Objects

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

Post Reply
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Playing with HMG Objects

Post by dhaine_adp »

Hi friends,

I tested HMGObjects, the latest released along with a working application. But before the test I made a few tweaks as follows:

1. I've copied objects.ch to hmg\include
2. I've added #include "objects.ch" to the bottom of minigui.ch
(To save time instead of modifying the source codes). I've also found hmg.ch on hmg\include but it seems the best place for me is to put it in into minigui.ch since this has been included in the prg source #include statement.
3. Then I've modified objects.prg and removed the paths e.g. set procedure to ..\..\source\application and changed it into set procedure to application, button, etc...
4. I recompile HMGObjects and packaged them as libHMGObjects.a

So here's the script for hmgobjects.gcc:

Code: Select all

HRB_DIR = c:/hmg/harbour
INC_DIR = c:/hmg/include
OBJ_DIR = f:/dad/hmgobjects/source --> replaced this with your source paths or obj path
LIB_DIR = f:/dad/hmgobjects/source --> replaced this with your source paths or lib path
SRC_DIR = f:/dad/hmgobjects/source --> replaced this with your source paths or src path

CFLAGS = -Wall -mno-cygwin -O3 

all: \
   $(LIB_DIR)/libhmgobjects.a \

$(LIB_DIR)/libhmgobjects.a : \
   $(OBJ_DIR)/objects.o 

	ar rc $@ $^

$(OBJ_DIR)/objects.o : $(OBJ_DIR)/objects.c

$(OBJ_DIR)/objects.c   : $(SRC_DIR)/objects.prg
	$(HRB_DIR)/bin\harbour.exe $^ -n    -I$(HRB_DIR)/include -i$(INC_DIR) -d__WINDOWS__ -o$@ $^

.prg.c:
	$(HRB_DIR)/bin\harbour.exe $^ -n   -I$(HRB_DIR)/include -i$(INC_DIR) -d__WINDOWS__ -o$@ $^

.c.o:
	gcc $(CFLAGS) -c -I$(INC_DIR) -I$(HRB_DIR)/include -o $@ $^

5. Then I copied makehmg.bat from hmg\source to my present working directory which is dad\hmgobjects\source, this where I expanded the source files for hmg objects. I did a little changes there, in particular to del statement only and the call for the script. I removed the
pointers to the path statement to make them del *.o and so on. After I completed that, I copied the libhmgobjects.a to hmg\lib.

6. Next I fire-up HMG IDE and my text editor and load demo_3.prg from main.menu (directory is renamed to mainmenu, HMG IDE does not accept the path). Right before the include statement I inserted #include 'minigui.ch". And I played some more with demo_3 and added a static function to display a child window and msginfo() only using the syntax from minigui.ch. Up to this point it works fine.

7. So to see what would be the effect, I recompile a working application and added hmgobjects to the Additional libs: under

configuration tab of HMG IDE. I was expecting a run-time-error but instead I've got syntax error as follows:

hbmk2: Processing configuration: C:\hmg\harbour\bin\hbmk.cfg
hbmk2: Processing: Trends.hbc
hbmk2: Compiling Harbour

sources...
Harbour 2.0.0 (Rev. 13372)
Copyright (c) 1999-2010, http://www.harbour-project.org/
F:/TRENDS/SOURCE/trends.prg(115) Error E0030 Syntax error "syntax error at '.'"
F:/TRENDS/SOURCE/trends.prg(133) Error E0030 Syntax error "syntax error at '.'"
F:/TRENDS/SOURCE/trends.prg(162) Error E0061 Implicit send operator with no WITH OBJECT in sight
F:/TRENDS/SOURCE/trends.prg(164) Error E0030 Syntax error "syntax error at '.'"
F:/TRENDS/SOURCE/trends.prg(165) Error E0030 Syntax error "syntax error at '.'"
F:/TRENDS/SOURCE/trends.prg(173) Error E0030 Syntax error "syntax error at '.'"
F:/TRENDS/SOURCE/trends.prg(176) Error E0030 Syntax error "syntax error at '.'"
F:/TRENDS/SOURCE/trends.prg(196) Error E0030 Syntax error "syntax error at '.'"
8 errors

In conclusion, the syntax errors are mainly because of conflict of semi-oop statement and oop statement syntax. And of course due to those controls that has no oop wrappers and :lol: HMG Objects is still experimental so I think there's nothing wrong with experimentation...

Now, I am wondering if it is possible to translate those semi-oop statement thru compiler directives when hmgobjects is linked-in? With the arrival of HMG Objects which syntax are we going to adapt?

IMHO, and for compatibility with the HMG semi-oop syntax HMGObjects somehow translate those semi-oop to full oop syntax.

Well, it's not that I'm too lazy to modify my source codes it's because whether hmgobjects is linked or not, semi-oop has been a hallmark of HMG all through these years. So with the advent of HMGObjects the same HMG tranditional syntax can be used and or a full oop syntax can be used. So for those who do not want OOP syntax but if they linked-in the HMGObjects they are not aware that they are using OOP. For those OOP aficionados they can used OOP syntax as in the case of this latest build.

As I have said, if there is a way to translate those semi-oop at compile time it is far more better.

Anyway, whatever will be the direction of Master Roberto for sure I'll follow.....

HMG is just getting better and better and very interesting too...


Regards,


Danny
Regards,

Danny
Manila, Philippines
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Playing with HMG Objects

Post by Roberto Lopez »

dhaine_adp wrote:Hi friends,

I tested HMGObjects, the latest released along with a working application. But before the test I made a few tweaks as follows:
<...>
I'm designing HMG OBJECTS to use HMG GUI library as back-end, exactly as the test package does (not in other ways).

The theoretical path (not a promise) is as follows:

1. Finish HMG OBJECTS (HMG GUI library connected).

2. Create an HMG compatibility layer ON TOP of HMG OBJECTS.

3. Connect it with a multi-platform GUI framework (probably GTK, wxWidgets or QT).

4. So, HMG become multi-platform.

This is just an idea. I don't know if I'll have the required time to do it (I do HMG in my free time).

ANyway, HMG OBJECTS itself is nearly finished (the most important things are already in place) and HMG compatibility will be easy to do.

The beauty of this, is that because the simple design of HMG OBJECTS, the connections with alternate back-ends could be done by anyone without knowledge about HMG internals, giving to HMG, alternate life in new platforms, beyond me :)
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: Playing with HMG Objects

Post by dhaine_adp »

Hi Roberto,

Thank you for sharing your idea. I truly admire your coding and analytical skills especially in designing HMG and HMG Objects. Perhaps I can safely say that all (maybe) of us (HMG users) attempted to build an oop wrappers for the core library but none of us comes close to your implementation. It simply amazing....

Have a nice day,

Danny
Regards,

Danny
Manila, Philippines
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: Playing with HMG Objects

Post by karweru »

Many thanks Roberto. The latest developments have taken HMG to a whole new level...HMG as a multi-platform GUI framework? I can't wait.... :) Thank you most of all for keeping it simple!
Kind regards,
Gilbert.
Post Reply