FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Converting an old Clipper app
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Converting an old Clipper app
Posted: Tue Jan 27, 2015 11:17 AM

I must ocnverte these lines from old clipper
someone can help me please (I use cdx tag)

or->(dbCreateIndex("orario.$$1", ;
"MA->prec + DO->punti", {|| ;
(MA->(dbGoto(OR->materia)), ;
DO->(dbGoto(OR->prof)), MA->prec + ;
DO->punti + eval({|| (DevPos(14, 14), iif(!EOF(), ;
DevOut(Replicate("²", RecNo() * 51 / LastRec())), Nil), ;
"")}))}))

  OR->(dbCreateIndex("orario.$$2", ;
  "OR->classe + str( OR->gruppo, 3 ) + OR->gg_ora", ;
  {|| OR->classe + Str(OR->gruppo, 3) + OR->gg_ora + ;
  eval({|| (DevPos(14, 14), iif(!EOF(), DevOut(Replicate("²", ;
  RecNo() * 51 / LastRec())), Nil), "")})}))
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Converting an old Clipper app
Posted: Wed Jan 28, 2015 03:29 PM

Wow, that is some really complex stuff. It gives me a headache just to look at it.

What is the problem? Have you tried compiling it and it generates errors? If so, what are the errors?

Something else?

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Converting an old Clipper app
Posted: Thu Jan 29, 2015 08:17 AM

James,
I wrote on private email to you for this problem

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 16
Joined: Wed Feb 04, 2015 02:26 PM
Re: Converting an old Clipper app
Posted: Wed Feb 04, 2015 06:07 PM
These calls create indexes and use a "trick" to show a progress bar, that is calculated and shown for each record, together with cursor positioning. I don't know which Clipper version you were using with that code but [x]Harbour can call a callback function every x indexed records. In this way you'll use a supported, official, less invasive tecnique.
Please open the file std.ch from [x]Harbour include directory and search for INDEX ON and you will find that INDEX ON.... is split into ordCondSet() and ordCreate() function calls. With the first call you can specify filters and also the callback function. It seems to me that the progress bar is 50 chars wide... with the new functions you will move the cursor, calculate and display the progress bar only 50 times...

You say that you use the cdx tag. But it seems to me that you are not actually using multitag (one file with multiple indexes inside) but only one file one index in cdx format. But I may be wrong.

orario.$$2 seems "easy".

What puzzle me a bit is orario.$$1...
Code (fw): Select all Collapse
or->(
   dbCreateIndex("orario.$$1",           // for each record in OR(ario)
      "MA->prec + DO->punti",
      {|| (MA->(dbGoto(OR->materia)), ;  // move record in workarea MA(terie)
           DO->(dbGoto(OR->prof)),       // move record in workarea DO(centi)
           MA->prec + DO->punti + ;      // create the string to use as index
           eval( {||""}) ;               // eval always returns ""
           )  }  )  )


Probably I'd use a SET RELATION and not the dbGoto... well, actually the dbGoto is the equivalent of the SET RELATION... but SET RELATION moves the pointers in other workareas automatically... but you need to set them up every time you open the files... so PROs and CONS...

Anyway, I think that this is a smart way to avoid using a new table for setting the relations between the three records...!

Continue the discussion