Re: [Harbour] field->&("name") in a macro

2010-03-22 Thread Przemysław Czerpak
On Mon, 22 Mar 2010, Szak�ts Viktor wrote: Hi, > BTW does __DBTRANS( d, a ) copy one record at > a time? __dbTrans() is undocumented Clipper function. Current Harbour implementation accepts the following parameters: __dbTrans( , , , , ; , , ) so it can be used to transfer an

Re: [Harbour] field->&("name") in a macro

2010-03-22 Thread Viktor Szakáts
Hi Przemek, I've reviewed this old (but highly critical) code of mine, and could optimize out FieldPos() calls altogether from the table upgrade functionality, speed almost doubled and still working on optimizations. The rest of cases don't seem to be real a bottleneck. So it looks like there

Re: [Harbour] field->&("name") in a macro

2010-03-22 Thread Przemysław Czerpak
On Mon, 22 Mar 2010, Maurilio Longo wrote: Hi, > > For tables which have very big number of fields the speed > > improvement should be huge. Accessing fields by name is > > relatively very slow operation and all RDD methods which > > transfer records between workareas use such translation > > tab

Re: [Harbour] field->&("name") in a macro

2010-03-22 Thread Maurilio Longo
Przemysław Czerpak wrote: > On Mon, 22 Mar 2010, Szak�ts Viktor wrote: > For tables which have very big number of fields the speed > improvement should be huge. Accessing fields by name is > relatively very slow operation and all RDD methods which > transfer records between workareas use such tran

Re: [Harbour] field->&("name") in a macro

2010-03-22 Thread Przemysław Czerpak
On Mon, 22 Mar 2010, Szak�ts Viktor wrote: Hi, > - Transferring records from one table to another, > with overlapping set of fields but different structure. > (to/from temp tables f.e. for quick browsing or editing > sub-tables) > - Upgrading tables to new structure. > And this pretty muc

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Viktor Szakáts
Hi, >> I didn't recheck all places, but quick review shows that my code actually >> relies on this Clipper feature, so adding RTE would require to rethink some >> lower level functions > > Hi, > > I do not use any FIELDGET(), FIELDPUT() on fields that do not exists, so, I > also like the idea

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Mindaugas Kavaliauskas
Viktor Szakáts wrote: IMO HB_FIELDGET() should return NIL if the name doesn't exist, just like FIELDGET() returns NIL if the field position doesn't exist. I didn't recheck all places, but quick review shows that my code actually relies on this Clipper feature, so adding RTE would require to

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Mindaugas Kavaliauskas
Alexandr Okhotnikov wrote: These are more clear without & : 1) alias1->NAME1 += alias2->NAME2 2) alias1->(NAME1 := NAME1 + alias2->NAME2) (I assumed FIELDNUM() means FIELDPOS()) NAME1 - is a variable, not a field name therefore, this example is invalid So, all discussion about ALIAS2-> (FIELD

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Viktor Szakáts
>> IMO HB_FIELDGET() should return NIL if the name >> doesn't exist, just like FIELDGET() returns NIL >> if the field position doesn't exist. Similarly, >> HB_FIELDPUT() should return logical value just >> like FIELDPUT(). > > RTE greatly helps to locate and fix bugs in code. But it breaks wi

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Alexandr Okhotnikov
HI 2010/3/21 Przemysław Czerpak : > On Sun, 21 Mar 2010, Alexandr Okhotnikov wrote: > It was always working in all Harbour versions. Sorry Too much work. That a result of checking the other thing (where the error occurred on another occasion: MEMVAR-> & ( "name")) But macro! Anyway really want

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Przemysław Czerpak
On Sun, 21 Mar 2010, Szak�ts Viktor wrote: Hi, > IMO HB_FIELDGET() should return NIL if the name > doesn't exist, just like FIELDGET() returns NIL > if the field position doesn't exist. Similarly, > HB_FIELDPUT() should return logical value just > like FIELDPUT(). RTE greatly helps to locate

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Viktor Szakáts
> 2010/3/21 Viktor Szakáts : >>> >>> FUNC MAIN() >>> >>> DBCREATE( "aa.dbf", { { "DACC", "C", 10, 0 } } ) >>> >>> use aa.dbf alias aa new >>> DBAPPEND() >>> aa->DACC := "hello" >>> ? "aa->DACC :", aa->DACC >>> ? 'aa->&("DACC") :', aa->&("DACC") >> >> It works here in all combinations. > > Yes

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Przemysław Czerpak
On Sun, 21 Mar 2010, Alexandr Okhotnikov wrote: Hi > > It works here in all combinations. > Yes works if compiled with "bin/hbmk2" > Before that I compiled with "bin/harbour" - did not work (missed what > the parameters of the compilation?) Please stop to confuse user. It was always working in a

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Viktor Szakáts
>> BTW, maybe it would be also useful to add >> HB_FIELDPUT()/HB_FIELDGET() which would also >> accept field _name_ as parameter. > > Interesting proposition though it will make the same job as > FIELDGET( FIELDPOS( ) ) / FIELDPUT( FIELDPOS( ), ) > so I do not know if it's really necessary. A

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Przemysław Czerpak
On Sun, 21 Mar 2010, Alexandr Okhotnikov wrote: Hi > Example! > > FUNC MAIN() > DBCREATE( "aa.dbf", { { "DACC", "C", 10, 0 } } ) > use aa.dbf alias aa new > DBAPPEND() > aa->DACC := "hello" > ? "aa->DACC :", aa->DACC > ? 'aa->&("DACC") :', aa->&("DACC") > > RETURN 0 Have you tested it? dru

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Alexandr Okhotnikov
Hi 2010/3/21 Viktor Szakáts : >> >> FUNC MAIN() >> >> DBCREATE( "aa.dbf", { { "DACC", "C", 10, 0 } } ) >> >> use aa.dbf alias aa new >> DBAPPEND() >> aa->DACC := "hello" >> ? "aa->DACC :", aa->DACC >> ? 'aa->&("DACC") :', aa->&("DACC") > > It works here in all combinations. Yes works if compiled

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Przemysław Czerpak
On Sun, 21 Mar 2010, Szak�ts Viktor wrote: Hi, > > But it's not Clipper compatible. Clipper does not support > >-> &( ) > > in macro compiler. Anyhow we can add such extension. > > It's enough to add 1 line macro.y. > > We already added many extensions to our macrocompiler eliminating > > Cl

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Viktor Szakáts
> Example! > > FUNC MAIN() > > DBCREATE( "aa.dbf", { { "DACC", "C", 10, 0 } } ) > > use aa.dbf alias aa new > DBAPPEND() > aa->DACC := "hello" > ? "aa->DACC :", aa->DACC > ? 'aa->&("DACC") :', aa->&("DACC") It works here in all combinations. Brgds, Viktor _

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Alexandr Okhotnikov
Hi 2010/3/21 Przemysław Czerpak : > On Sun, 21 Mar 2010, Alexandr Okhotnikov wrote: > So if no one has sth against then I'll commit modification which > enable support for above syntax. Please add this >> The issue arose from the fact that it works in the PRG, but in the >> macro and the HRB doe

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Viktor Szakáts
Hi, >> IMO first version is still better > > But it's not Clipper compatible. Clipper does not support >-> &( ) > in macro compiler. Anyhow we can add such extension. > It's enough to add 1 line macro.y. > We already added many extensions to our macrocompiler eliminating > Clipper macrocompi

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Przemysław Czerpak
On Sun, 21 Mar 2010, Alexandr Okhotnikov wrote: Hi, > IMO first version is still better But it's not Clipper compatible. Clipper does not support -> &( ) in macro compiler. Anyhow we can add such extension. It's enough to add 1 line macro.y. We already added many extensions to our macrocomp

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Viktor Szakáts
Hi, >> You can even create a simple macro: >> >> #xtranslate FIELDGETBYNAME( ) => FIELDGET( FIELDPOS( ) ) >> >> and use: >> >> RETURN FIELDGETBYNAME( name ) > > Compare the ease of writing and understanding: > > 1. ALIAS1->&("NAME1") + = ALIAS2->&("NAME2") + something > 2. ALIAS1->(FIEL

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Alexandr Okhotnikov
Hi 2010/3/21 Viktor Szakáts : >> 1. ALIAS1-> & ( "NAME1") + = ALIAS2-> & ( "NAME2") >> 2. ALIAS1-> (FIELDPUT (FIELDNUM ( "NAME1"), FIELDGET (FIELDNUM ( >> "NAME1") + ALIAS2-> (FIELDGET (FIELDNUM ( "NAME2" > You can even create a simple macro: > >   #xtranslate FIELDGETBYNAME( ) => FIELDGET(

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Mindaugas Kavaliauskas
Alexandr Okhotnikov wrote: Can an example of effective solutions? And why this decision is not effective? FieldGet (fieldnum ()) - a very cumbersome example: 1. ALIAS1-> & ( "NAME1") + = ALIAS2-> & ( "NAME2") 2. ALIAS1-> (FIELDPUT (FIELDNUM ( "NAME1"), FIELDGET (FIELDNUM ( "NAME1") + ALIAS2-> (F

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Viktor Szakáts
> Hi > > Can an example of effective solutions? > And why this decision is not effective? > > FieldGet (fieldnum ()) - a very cumbersome > example: > 1. ALIAS1-> & ( "NAME1") + = ALIAS2-> & ( "NAME2") > 2. ALIAS1-> (FIELDPUT (FIELDNUM ( "NAME1"), FIELDGET (FIELDNUM ( > "NAME1") + ALIAS2-> (FIELDG

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Alexandr Okhotnikov
Hi Can an example of effective solutions? And why this decision is not effective? FieldGet (fieldnum ()) - a very cumbersome example: 1. ALIAS1-> & ( "NAME1") + = ALIAS2-> & ( "NAME2") 2. ALIAS1-> (FIELDPUT (FIELDNUM ( "NAME1"), FIELDGET (FIELDNUM ( "NAME1") + ALIAS2-> (FIELDGET (FIELDNUM ( "NAME

Re: [Harbour] field->&("name") in a macro

2010-03-21 Thread Viktor Szakáts
Hi, This is very twisted and inefficient syntax. If this is used in thousands of places it's probably worth to write a little application which goes through the whole app and swaps it with the efficient solution. Brgds, Viktor On 2010 Mar 20, at 23:06, Alexandr Okhotnikov wrote: > Hi, > > H

Re: [Harbour] field->&("name") in a macro

2010-03-20 Thread Xavi
Harbour has the same behavior as Clipper .- proc main() PUBLIC VAR := 'Hello' ? M->&("VAR") // Ok ? xxx( "VAR" ) // Ok ? Eval( &('{|| M->'+"VAR"+'}') ) // Ok ? Eval( &('{|| M->&("VAR") }') ) // Error BASE/1449 Syntax error: & return func xxx( name ) // b := &( "{|| field->" +

[Harbour] field->&("name") in a macro

2010-03-20 Thread Alexandr Okhotnikov
Hi, How can I compile (and run) this code in a macro: field->&("name") example: func xxx( name ) local b := &( "{|| field->&('" + name + "') }" ) return eval( b ) Error BASE/1449 Syntax error: & PS in *.hrb the exact same error PPS Alaska XBase++: compiles without errors (I convert the code