How To Convert Clipper Application's Compilation Method/Routine to Harbour Compilation Routine/Method/Procedure

2,106 views
Skip to first unread message

SD

unread,
Aug 8, 2012, 3:57:03 PM8/8/12
to harbou...@googlegroups.com
Dear All:
Yes, indeed a very basic (and novice) Question.........how to build an exe for a complete real-life application in Harbour

The Said Clipper Application has the following compiling method:

exe=office.exe
main prg=office.prg
1)MY.BAT : THE BATCH FILE FOR THE TOTAL COMPILATION & GENERATING THE EXE FOR THE APPLICATION

REM * --------- MY.BAT --------- *
REM * Written By:Swapan Das      *
REM * Written On:15-Feb-2010     *
REM * -------------------------- *
@echo off
cls
del office.obj
del skdfunc2.obj

clipper @Office_1 /m/n
pause
clipper @Office_2 /m/n
pause
clipper @Office_3 /m/n
pause
clipper @Office_4 /m/n
pause
clipper @Office_5 /m/n
pause
clipper @Office_6 /m/n
pause
clipper @Office_7 /m/n
pause
clipper @Office_8 /m/n
pause

clipper combo2 /m/n/w
Clipper SkdArray /n/w/a/m

pause
rtlink @Office output Office lib skdlib
pause

Office.exe
rem c:\clipper5\bin\
REM : end-of-file

2)CLP FILES:

Office_1.clp file contains:
Office
SysHelp

Office_2.clp file contains:
Office1
MakeFile
rbldmain
findex
 
All in the same way all other Office_?.clp files contains the names of the total prgs for the application.

3)LNK FILE:
Office.lnk file contains:
FILE Office_1,Office_2,Office_3,Office_4,Office_5,Office_6,office_7,office_8,Combo2,SkdArray

4)SKDLIB.BAT: THE BATCH FILE TO CREATE THE LIBRARY (of user defined/application functions)
clipper skdfunc2 /oskdlib.lib

[note: skdfunc2.prg contains all the functions for the application and also calls 3 more prgs for additional functions by the command:
set procedure to prg1
set procedure to prg2
set procedure to prg3
]

THE HARBOUR EQUIVALENT:

1)SKDLIB.BAT - This is not creating my library "SkdLibHb.lib"  for the user-defined functions?? Though no error during compilation...
hbmk2 skdfunc2 -hblib -oSkdLibHb

[note1: skdfunc2.prg contains all the functions for the application and also calls 3 more prgs for additional functions by the command:
set procedure to prg1
set procedure to prg2
set procedure to prg3

note2: in clipper when skdfunc2.prg is compiled , the other 3 prgs (prg1,prg2,prg3) also gets compiled....here these three prgs are not getting compiled I think..
]


2)MY.BAT: THE BATCH FILE TO CREATE THE EXE FOR THE APPLICATION IN HARBOUR
@echo off
cls
skdlib.bat
pause
hbmk2 office.hbp -m -n -lskdlibhb.lib
pause

3)OFFICE.HBP - THE HBP FILE FOR THE APPLICATION
This file contains the list of total prgs which were mentioned in clp files for clipper compilation
Office
SysHelp
Office1
MakeFile
rbldmain
findex
ItemRate
....... and so on of all prg names.

BUT the exe is not buiding.... (
There's no error,and its seems to be ok, When I compile:
hbmk2 office.hbp -m -n

Perhaps the issue is with library not getting created...read my note for the library 1)SKDLIB.BAT

Perhaps this is not the right way to throw an issue.....but please help me in building the exe...

Thanks & Regards,
Swapan Das

SD

unread,
Aug 9, 2012, 4:42:14 AM8/9/12
to harbou...@googlegroups.com
If the above script gives a sense of "annoyance" in your mind, then please just try to resolve my issue with user-defined Library file creation:

THE WORKING CLIPPER VERSION - SKDLIB.BAT: THE BATCH FILE TO CREATE THE LIBRARY (of user defined/application functions)

clipper skdfunc2 /oskdlib.lib
 
[note: skdfunc2.prg contains all the functions for the application and also 
calls 3 more prgs for additional functions by the command:
set procedure to prg1
set procedure to prg2
set procedure to prg3
]


THE HARBOUR VERSION - SKDLIB.BAT: THE BATCH FILE TO CREATE THE LIBRARY (of user defined/application functions)

hbmk2 skdfunc2 -hblib -oSkdLibHb 

note:
list of prgs reqd. for the lib:
skdfunc2.prg is the main function prg.
prg1.prg
prg2.prg
prg3.prg
skdfunc2.prg calls internally the above three prgs:
using command: set procedure to prg1
                         set procedure to prg2
                         set procedure to prg3 


Lib name (to be created in Harbour):SkdLibHb.lib

CURRENT STATUS:
SKDLIB.BAT - This is not creating my library "SkdLibHb.lib" for the user-defined functions. Though no error during compilation...

CarozoDeQuilmes

unread,
Aug 9, 2012, 7:23:14 AM8/9/12
to harbou...@googlegroups.com
Hi, in Harbour you need to use the hbmk2 included tool with .hbm scripts.  Look at sources to see examples

Regards
CdQ


--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users



--
CdQ

Swapan Das

unread,
Aug 9, 2012, 7:39:03 AM8/9/12
to harbou...@googlegroups.com
Thanks CdQ......
So this is not enough to create a lib file?:
hbmk2 skdfunc2 -hblib -oSkdLibHb  

What is  ".hbm" file? A script for creating lib??  It produces what? Yes, will refer to the examples...

Thanks & Regards,
Swapan Das

Bruno Luciani

unread,
Aug 9, 2012, 1:54:02 PM8/9/12
to harbou...@googlegroups.com
Yes probably this is correct , but you can include dis modificators or commands in an .HBM file

and call this file , but you can do it manually as you show in your command

But think in a large list of command ? is better to use .HBM file

Greetings

Bruno

2012/8/9 Swapan Das <swapan...@gmail.com>

Qatan

unread,
Aug 9, 2012, 3:49:49 PM8/9/12
to harbou...@googlegroups.com
Hello Swapan,
 
       hbmk2 skdfunc2 –hblib –oSkdLibHb
 
    is the same as:
   
       hbmk2 file.hbm
   
    where file.hbm is a text file with:
 
       skdfunc2
       -hblib
       -oSkdLibHb
 
    both will give the exact same result so instead of creating batch files you could simple create .HBM files (or .HBP for “Projects”) and simple use hmbk2 file.hbp (or simple hbmk2 file) it will compile in just one command. So it is simpler than the way you are used to do with Clipper.
 
    To see all the options try hbmk2 –Help (there are many options but you can put all the options on the .HBP or .HBM file) There is also .HBC file that  is automatically linked to the project (if hbmk2 find it where you are building your application).
    I simply use hbmk2 myproject and in myproject.hbp I put all the files, configurations, libs, resource file, etc...)
    I hope it helps.
 
Qatan
Swapan Das
 



--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.

Swapan Das

unread,
Aug 10, 2012, 12:05:58 AM8/10/12
to harbou...@googlegroups.com
Thanks Bruno Luciani for responding to the issue. Yes, Greetings from India also...

Swapan Das

unread,
Aug 10, 2012, 12:18:49 AM8/10/12
to harbou...@googlegroups.com
Dear Qatan:

Thank you so much for the clarification. In that case my script should have produced the required library and the exe for the application.
Will do the necessary changes to make it more simpler as you suggested.

But I've also made .hbp file for the project, you may check the script/method I've used to convert from my Clipper ver. to Harbour ver.

What is the default extension (lib or hbc) for a user-defined library when compiled by the default compiler MinGW in Harbour 3.0?

And once again thanks for the help.

Thanks & Regards,
Swapan Das

Qatan

unread,
Aug 10, 2012, 8:40:53 AM8/10/12
to harbou...@googlegroups.com
Hello Swapan,
 
    With Borland C Compiler (BCC) you can create .LIB files (but BCC is not recommended).
    With MingW you can create .A files (.a is the equivalent to .lib but for MingW).
 
    I strongly suggest you to look the .HBP / .HBC files on the Examples folder. There you can see many possibilities (examples may explain better than words).
    For lib creation I suggest you to look the .HBX / .HBM / .HBC files on the Contrib folder. (I do not have any experience creating libs).
    I hope it will be useful to you.
    Regards,
 
Qatan
 
From: Swapan Das
Sent: Friday, August 10, 2012 6:18 AM
Subject: Re: [harbour-users] Re: How To Convert Clipper Application's Compilation Method/Routine to Harbour Compilation Routine/Method/Procedure
 

SD

unread,
Aug 11, 2012, 3:23:51 AM8/11/12
to Harbour Users
Dear Qatan:

Thank you so much for your feedback.
Will definitely look into your suggestions.

This weekend, I'm a bit busy. Will check ASAP and revert....

Regards,
Swapan

SD

unread,
Aug 13, 2012, 1:58:06 PM8/13/12
to harbou...@googlegroups.com
Quick Update:
- Finally was able to create my library with mingW..
- Able to build the executable (the application exe)

But Issues with Opening files now....
The initial screen of the application comes, but it throws following error:

Error DBCMD/1010  Illegal characters in alias: PJTR12-3

File17:= p_datapath+[\]+[&p_pjtransfl]+[.dbf]

File17a:= p_indexpath+[\]+[&p_pjtransfl]+[.b01]    //  mr_no wise , ntx index type
sele 17

use &file17 shared  [this line is giving error....]
if !file('&file17a')
   inde on mr_no to &file17a
endi

Please note, the said application which runs smoothly was in Clipper 5.01 and here I've not used any settings for ntx like "REQUEST DBFNTX" etc.
My this Harbour application did created all the new index files, but it gives error as mentioned.
Prior to this file17, other dbf files with similar kind of name specs didn't gave this error, but when it comes to file17 its giving error. I've replaced the said dbf with another version of the dbf also - still the error remains...

How to overcome this? Please suggest...

Regards,
Swapan

francesco perillo

unread,
Aug 13, 2012, 2:17:24 PM8/13/12
to harbou...@googlegroups.com

Can you print file17a value?

Can you add ALIAS MYTEST to the line? Program will not work still but can give more info.

It seems to me that code needs some refactoring ;-)

José M. C. Quintas

unread,
Aug 13, 2012, 6:12:35 PM8/13/12
to harbou...@googlegroups.com
When you do not specify an alias, Harbour and Clipper uses the name of dbf.
Seems that value of file17 is not valid for alias.
Check value, or use an alias.

use (file17) shared alias mydbf

Jos� M. C. Quintas

From: SD
Sent: Monday, August 13, 2012 2:58 PM
To: harbou...@googlegroups.com
Subject: [harbour-users] Re: How To Convert Clipper Application's
Compilation Method/Routine to Harbour Compilation Routine/Method/Procedure

SD

unread,
Aug 14, 2012, 12:57:44 AM8/14/12
to harbou...@googlegroups.com
Dear Fperillo and José M. C. Quintas:

Thanks for paying attention to my issue and for the suggestions...

Currently am at work, so unable to do the required test. What I missed to mention in my last post was that I did used the alias at the end after indexing:

File17:= p_datapath+[\]+[&p_pjtransfl]+[.dbf] 
File17a:= p_indexpath+[\]+[&p_pjtransfl]+[.b01]    //  mr_no wise , ntx index type 
sele 17 
use &file17 shared  [this line is giving error....
if !file('&file17a') 
   inde on mr_no to &file17a 
endi 
sele 17
use &file17 inde &file17a alia Pjtrans shared

Are you people suggesting to use the coding in this way:
sele 17
use &file17 alia Pjtrans shared (the correct way??, but upto file15 I've used only "use &file14 shared", and they are giving any error!)
if !file('&file17a') 
   inde on mr_no to &file17a 
endi
sele 17
use &file17 inde &file17a alia Pjtrans shared

Before posting my this issue, I did checked the value for FILE17 dbf. It was ok (file17 = d:\common\database\2012-13\Pjtrn12-3.dbf) and the value for FILE17A, the index file. (file17a = d:\common\index\2012-13\Pjtrn12-3.b01). All seems to be ok.

Expecting to revert here after 10-12 hrs, when I'll be done with the test run. Meanwhile, I'm eager to know if I'm missing anything here......

Not hearing any more from Kalas?! Sir are you listening........
Regards,
Swapan

On Tuesday, 14 August 2012 03:42:35 UTC+5:30, José M. C. Quintas wrote:
When you do not specify an alias, Harbour and Clipper uses the name of dbf.
Seems that value of file17 is not valid for alias.
Check value, or use an alias.

use (file17) shared  alias mydbf

Jos� M. C. Quintas

SD

unread,
Aug 14, 2012, 1:02:08 AM8/14/12
to harbou...@googlegroups.com
Sorry for the typo mistake. It should be read:

sele 17
use &file17 alia Pjtrans shared (the correct way??, but upto file15 I've used in this way only "use &file15 shared", and they are NOT giving any error!)

Klas Engwall

unread,
Aug 14, 2012, 5:57:07 AM8/14/12
to harbou...@googlegroups.com
Hi Swapan,

> Not hearing any more from Klas?! Sir are you listening........

Yeah, I am here, but I did not feel the need to jump in and repeat what
had already been said. Since you ask, though ... yes I agree with
Francesco about the refactoring suggestion :-). The code looks a little
messy, and messy code tends to do unexpected things.

On the alias subject: It is always a good idea to provide a valid alias.
If you do, you can use any name that the OS permits for the dbf file,
and you need not worry about illegal characters (illegal for aliases)
from the file name unexpectedly trashing the alias.

I would also suggest that you look at the Clipper 5.x coding standards
and try to move away from the old dBaseII/III style. It might be a big
job, but it pays off in the end. For the code you posted, dbusearea()
and related functions would be a good start.

Regards,
Klas

Swapan Das

unread,
Aug 14, 2012, 7:37:59 AM8/14/12
to harbou...@googlegroups.com
Dear Klas Engwall:

Thanks for listening and responding to my plea.......

First I need to port my existing & running running Clipper code to
Harbour with minimum changes. My this "messy" practice is what I
learnt from the seniors , who must have picked the Dbase coding
pattern when they started. For years with numerous applications they
have "played" ok. Yes, I would definitely want to change it to more
"modern" and "acceptable" pattern but am not sure how to revamp it.

I would love to learn from you how it could be accomplished on more
modern way.....will you allow me to send you a very small piece of
reduced sample code I'm practising now for File initialization,
opening & indexing?

Meanwhile will check for the fault finding....and revert..

Regards,
Swapan
> --
> You received this message because you are subscribed to the Google
> Groups "Harbour Users" group.
> Unsubscribe: harbour-user...@googlegroups.com
> Web: http://groups.google.com/group/harbour-users
>


--
*Thanks & Regards,*
*Swapan Das*
http://placentrex.blogspot.com/
Join me @ Google+<https://plus.google.com/102379266475702711710/about?hl=en#102379266475702711710/about>

Klas Engwall

unread,
Aug 14, 2012, 10:15:30 AM8/14/12
to harbou...@googlegroups.com
Hi Swapan,

> Thanks for listening and responding to my plea.......
>
> First I need to port my existing & running running Clipper code to
> Harbour with minimum changes.

Yes, going in small steps is easier

> My this "messy" practice is what I
> learnt from the seniors , who must have picked the Dbase coding
> pattern when they started.

I know authors of Clipper books and Clipper add-on libraries who long
after going to print admitted having used bad practices, so you are in
good company. I did my share too :-)

Clipper Summer 87 and earlier were built to accept old dBase code.
Clipper 5 was a complete rewrite and introduced many new practices that
could not be used earlier. It still accepted the old syntax for
compatibility reasons, and so does Harbour. But moving on and using the
"new" syntax makes things easier in the long run.

> For years with numerous applications they
> have "played" ok. Yes, I would definitely want to change it to more
> "modern" and "acceptable" pattern but am not sure how to revamp it.

Many books were written in Clipper's heyday, some better than others.
They are of course all out of print now, but there are sometimes copies
available on Ebay and similar places. Maybe trying to find one of those
is a good idea. If you find anything, you can ask here for opinions.

> I would love to learn from you how it could be accomplished on more
> modern way.....will you allow me to send you a very small piece of
> reduced sample code I'm practising now for File initialization,
> opening & indexing?

If it is small and reduced and just sample code, why not post it here in
a new thread? There are many users here who can add their pieces of
advice. And maybe other users can benefit from the discussion too. But
take one piece at a time. This thread started with too many things in
one message, and that makes it difficult to know where to start
commenting in a structured way.

> Meanwhile will check for the fault finding....and revert..

OK

Regards,
Klas

José M. C. Quintas

unread,
Aug 14, 2012, 11:06:36 AM8/14/12
to harbou...@googlegroups.com
Your code is correct but you have 15 valid names for alias, and 1 invalid name for alias (or more).
 
You have 2 options:
- Change dbf name – routine will work until another invalid file name
- Update code to work with any file name adding an valid alias – will work forever
 
José M. C. Quintas
 
 
From: SD
Sent: Tuesday, August 14, 2012 2:02 AM

SD

unread,
Aug 14, 2012, 3:04:02 PM8/14/12
to harbou...@googlegroups.com

Dear  José M. C. Quintas:

Yes, I did this and IT WORKED finally! Thanks a lot.....


 - Update code to work with any file name adding an valid alias – will work forever
José M. C. Quintas

 

 

The minor change I did to the whole piece of coding:

 

sele 17
use &file17 alia Pjtrans shared  ----> using "alias" did the trick... prior to this I was using "use &file17 shared" : though I was using alias but only later...
if !file('&file17a') 
   inde on mr_no to &file17a 
endi
sele 17
use &file17 inde &file17a alia Pjtrans shared ---- > I used "alias" here only, it was needed above also...

 

So, I may Conclude by saying:


·         I'm very happy to announce that finally I'm able to float my EXE built on Harbour 3.0 using default compiler MingW, and IT'S RUNNING!

·         The EXE size has doubled!

Clipper exe->08/01/2012  03:43 PM         1,000,448 OldApp.EXE  977KB

Harbour exe->08/14/2012  09:48 PM         2,661,203 NewApp.exe  2.53MB

(SIZE DOES MATTERS?! .... Well its -VE impact not yet encountered..)

 

·         While my "messy" coding escaped from the eyes of Clipper 5.01, but Harbour (not sure if Clipper 5.2/5.3 would have triggered same errors also) architecture  stringent enough to pick such "loose" coding and disallowed it - good thing at the end...as my codes became better ( I mean comparatively:) ) to my previous coding technically.

 

·         Somehow, I felt gasping for clear-cut documentation - the one point reference place as far as the Compilation (esp. with MingW) and executable building of a real life application part is concerned. How to compile  my own library and linking it to the main application. There should be two examples –

1) Simple compilation script

2) A compilation script from a real-life working application which contains lot of prgs, user's own libraries and 3rd party libs. How to integrate all kind of thing....(with keeping in mind the beginners are from Clipper background and want the "alternatives" to their Clipper compilation make/script files - and please do not consider all to be of "ADVANCED LEVEL CLIPPER PROGRAMMERS" here)

 

 

 

 

·         The Learning Curve - Easy?!

 

1.     I liked the Installer of Harbour, which has made the task of installation and settings easy. This is what I use to like very much about xHarbour when I first had a taste of it, 3yrs back.

2.     Because of the help from this GROUP (forum), new members with average skills are managing to survive the initial jolts. I can understand I'm not paying for any services, the developers are not paid here - so its not easy to maintain everything and progress with a pace one would love to. So, this kind of forums/groups are very crucial to make the learning curve easy. 

 

·         FINALLY……..

1.     The successful building of EXE is my 1st step.....

2.     Thanks to all from my bottom heart in helping me in my this TEST RUN.... 

3.     WILL BE BACK (with a new thread!)...............and consider this THREAD CLOSED.

4.    Not expecting all to read till this line, hope Klas Engwall you are reading at-least. Thanks for being so supportive...it was really needed  & boosted me a lot.

 

Thanks & Regards,

Swapan Das

Reply all
Reply to author
Forward
0 new messages