Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Xavi

Lorenzo,

Try this, if may help you .-

Procedure Main()
   Local ID_TAB_AGENTI := "TAB_AGENTI"
   Local ID_TAB_CODDSP := "TAB_AGENTI"
   Local cSql  := "select 'Hello' as fld"
   Local cAnnDsp   := "2000"
   Local cFrmSQL

#pragma __cstream|cFrmSQL:=%s

select ( select substr( crectab, 1, 20 ) as crectab
   from tabtab where ctiptab = %1$t
   and ckeytab = ccodage order by 1 ) as cdesage, ;
   sum( case when ( select substr( crectab, 35, 1 ) from tabtab
   where ctiptab = %2$t and ckeytab = ccoddsp ) = '' or
   ( select substr( crectab, 35, 1 ) from tabtab
   where ctiptab = %2$t and ckeytab = ccoddsp ) is null
   then nimpdsp
   else 0 end) as ntotfat0,
   sum( case when ( select substr( crectab, 35,1 ) from tabtab
   where ctiptab = %2$t and ckeytab = ccoddsp ) = '1'
   then nimpdsp
   else 0 end) as ntotfat1,sum(nimpdsp) as ntotdsp,
   %3$s from tabtotdsp
   left join tabtab on tabtab.ctiptab= %2$t and ccoddsp=tabtab.ckeytab
   where canndoc = %4$t

#pragma __endtext

   ? sql_Sprintf( cFrmSQL, ID_TAB_AGENTI, ID_TAB_CODDSP, cSql, cAnnDsp )

   Wait
return

It seems to me that does the same and more.

HTH
--
Xavi

El 24/02/2010 21:03, Lorenzo Fiorini escribió:

On Wed, Feb 24, 2010 at 8:10 PM, Viktor Szakáts


It would be good to hear from you (as the only known
user of this feature) what is the benefit of using it,
f.e. over #pragma __cstream. Maybe there exists better
solution to keep support for it, than build-time or
compile-time switch.


For me it is not a compatibility issue but an absolute requirement.
All my code counts on it and will ever do. It would be completely
INSANE to write sql statements without HB_PP_MULTILINE.

This is a small example:

...
cSql := "select ( select substr( crectab, 1, 20 ) as crectab ;
 from tabtab where ctiptab = '" + ID_TAB_AGENTI + "' ;
  and ckeytab = ccodage order by 1 ) as cdesage, ;
  sum( case when ( select substr( crectab, 35,
1 ) from tabtab ;
 where ctiptab = '" +
ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) = '' or ;
 ( select substr( crectab, 35,
1 ) from tabtab ;
 where ctiptab = '" +
ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) is null ;
then nimpdsp ;
else 0 end) as ntotfat0, ;
  sum( case when ( select substr( crectab, 35,
1 ) from tabtab ;
 where ctiptab = '" +
ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) = '1' ;
then nimpdsp ;
else 0 end) as ntotfat1,
sum(nimpdsp) as ntotdsp,;
  " + cSql + " from tabtotdsp ;
 left join tabtab on tabtab.ctiptab= '" +
ID_TAB_CODDSP + "' and ccoddsp=tabtab.ckeytab ;
  where canndoc = '" + cAnnDsp + "'"
...

best regards,
Lorenzo

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Viktor Szakáts
> On Wed, Feb 24, 2010 at 9:14 PM, Viktor Szakáts  wrote:
> 
>> Is this feasible?
> 
> I don't know but please understand that without HB_PP_MULTILINE (
> exactly as it was ) Harbour for me is completely useless.
> 
> Tomorrow I'll do a meeting with my developers to decide what to do.

For now I moved this on compiler level, which 
makes it possible to use a standard build with 
a simple compiler switch. IOW it makes your life 
easier.

Now it causes only a minor overhead in PP code, 
so technically it's not a big problem, but I'd still 
like have a proper solution here, since storing 
free form string inside the source code seems like 
a valid problem, but the current solution is 
just a pile of ad-hoc hacks, and this is IMO not 
very good situation. (neither -kl nor #pragma).

BTW -kl (aka "PP multiline strings") has one ugly 
bad side-effect, it will also include all indentation 
spaces in compiled pcode, I know that storage and 
memory is cheap, but it doesn't look very good.

The other bit which looks strange is that 
#pragma __cstream needs to be closed with command 
ENDTEXT, I'd expect something like #pragma __cstreamend 
or similar.

Brgds,
Viktor

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Lorenzo Fiorini
On Wed, Feb 24, 2010 at 9:14 PM, Viktor Szakáts  wrote:

> Is this feasible?

I don't know but please understand that without HB_PP_MULTILINE (
exactly as it was ) Harbour for me is completely useless.

Tomorrow I'll do a meeting with my developers to decide what to do.

best regards,
Lorenzo
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Viktor Szakáts
I don't know if it's technically possible, but maybe 
a new kind of string marker would be the best solution 
to cover this case without adding build/compile time 
knobs, plus it could also cover #pragma __cstream, 
which looks VERY hacky, too.

---
cString := t"My long text
  which spans, 
  multiple lines"

cString := t'My long text 
  which contains "" chars, 
  without problem'
---

('t' prefix is tentative, can be anything, which we think fit)

Is this feasible?

Brgds,
Viktor

On 2010 Feb 24, at 21:03, Lorenzo Fiorini wrote:

> On Wed, Feb 24, 2010 at 8:10 PM, Viktor Szakáts
> 
>> It would be good to hear from you (as the only known
>> user of this feature) what is the benefit of using it,
>> f.e. over #pragma __cstream. Maybe there exists better
>> solution to keep support for it, than build-time or
>> compile-time switch.
> 
> For me it is not a compatibility issue but an absolute requirement.
> All my code counts on it and will ever do. It would be completely
> INSANE to write sql statements without HB_PP_MULTILINE.
> 
> This is a small example:
> 
> ...
> cSql := "select ( select substr( crectab, 1, 20 ) as crectab ;
>from tabtab where ctiptab = '" + ID_TAB_AGENTI + "' ;
> and ckeytab = ccodage order by 1 ) as cdesage, ;
> sum( case when ( select substr( crectab, 35,
> 1 ) from tabtab ;
>where ctiptab = '" +
> ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) = '' or ;
>( select substr( crectab, 35,
> 1 ) from tabtab ;
>where ctiptab = '" +
> ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) is null ;
>   then nimpdsp ;
>   else 0 end) as ntotfat0, ;
> sum( case when ( select substr( crectab, 35,
> 1 ) from tabtab ;
>where ctiptab = '" +
> ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) = '1' ;
>   then nimpdsp ;
>   else 0 end) as ntotfat1,
> sum(nimpdsp) as ntotdsp,;
> " + cSql + " from tabtotdsp ;
>left join tabtab on tabtab.ctiptab= '" +
> ID_TAB_CODDSP + "' and ccoddsp=tabtab.ckeytab ;
> where canndoc = '" + cAnnDsp + "'"
> ...
> 
> best regards,
> Lorenzo
> ___
> Harbour mailing list (attachment size limit: 40KB)
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Lorenzo Fiorini
On Wed, Feb 24, 2010 at 8:10 PM, Viktor Szakáts

> It would be good to hear from you (as the only known
> user of this feature) what is the benefit of using it,
> f.e. over #pragma __cstream. Maybe there exists better
> solution to keep support for it, than build-time or
> compile-time switch.

For me it is not a compatibility issue but an absolute requirement.
All my code counts on it and will ever do. It would be completely
INSANE to write sql statements without HB_PP_MULTILINE.

This is a small example:

...
cSql := "select ( select substr( crectab, 1, 20 ) as crectab ;
from tabtab where ctiptab = '" + ID_TAB_AGENTI + "' ;
 and ckeytab = ccodage order by 1 ) as cdesage, ;
 sum( case when ( select substr( crectab, 35,
1 ) from tabtab ;
where ctiptab = '" +
ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) = '' or ;
( select substr( crectab, 35,
1 ) from tabtab ;
where ctiptab = '" +
ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) is null ;
   then nimpdsp ;
   else 0 end) as ntotfat0, ;
 sum( case when ( select substr( crectab, 35,
1 ) from tabtab ;
where ctiptab = '" +
ID_TAB_CODDSP + "' and ckeytab = ccoddsp ) = '1' ;
   then nimpdsp ;
   else 0 end) as ntotfat1,
sum(nimpdsp) as ntotdsp,;
 " + cSql + " from tabtotdsp ;
left join tabtab on tabtab.ctiptab= '" +
ID_TAB_CODDSP + "' and ccoddsp=tabtab.ckeytab ;
 where canndoc = '" + cAnnDsp + "'"
...

best regards,
Lorenzo
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Viktor Szakáts
Hi Lorenzo,

On 2010 Feb 24, at 18:55, Lorenzo Fiorini wrote:

> On Wed, Feb 24, 2010 at 4:25 PM, Viktor Szakáts
> 
>> [ AFAIK only Lorenzo is using this feature. ]
>> 
>> So if there is no objection, I will mark it as deprecated.
> 
> No problem I can easily stop to update my Harbour tree.

It would be good to hear from you (as the only known 
user of this feature) what is the benefit of using it, 
f.e. over #pragma __cstream. Maybe there exists better 
solution to keep support for it, than build-time or 
compile-time switch.

Brgds,
Viktor

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Viktor Szakáts
Hi Vailton,

Please don't cut the whole message you're 
replying to, it makes it very difficult to 
figure the context.

Well, I'd prefer not to illustrate it, 
because this feature is kept for compatibility 
with old Harbour versions, and now there are 
better alternatives. I'll commit it ASAP, and 
you will see it.

Brgds,
Viktor

On 2010 Feb 24, at 18:52, Vailton Renato wrote:

> Exactly how this feature Viktor? I could not understand how to use it
> if you can illustrate something I will be grateful.
> 
> Regards,
> Vailton Renato
> ___
> Harbour mailing list (attachment size limit: 40KB)
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Lorenzo Fiorini
On Wed, Feb 24, 2010 at 4:25 PM, Viktor Szakáts

> [ AFAIK only Lorenzo is using this feature. ]
>
> So if there is no objection, I will mark it as deprecated.

No problem I can easily stop to update my Harbour tree.

best regards,
Lorenzo
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Vailton Renato
Exactly how this feature Viktor? I could not understand how to use it
if you can illustrate something I will be grateful.

Regards,
Vailton Renato
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread Viktor Szakáts
Well, actually I don't know if it's good idea to keep this 
feature at all, it looks very strange and probably it would 
be better to fix such .prg code to comply with Clipper, 
rather than keeping it compatible with pre-1.0.0 Harbour 
beta versions.

[ AFAIK only Lorenzo is using this feature. ]

So if there is no objection, I will mark it as deprecated.

Brgds,
Viktor

On 2010 Feb 24, at 16:11, vszak...@users.sourceforge.net wrote:

> Revision: 13982
>  
> http://harbour-project.svn.sourceforge.net/harbour-project/?rev=13982&view=rev
> Author:   vszakats
> Date: 2010-02-24 15:11:45 + (Wed, 24 Feb 2010)
> 
> Log Message:
> ---
> 2010-02-24 16:10 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
>  * src/pp/ppcore.c
>  * src/compiler/cmdcheck.c
>  * src/compiler/hbusage.c
>  * include/hbpp.h
>  * include/hbsetup.h
>* HB_USER_CFLAGS=-DHB_PP_MULTILINE_STRING feature converted
>  to compiler switch '-kl'.
>  INCOMPATIBLE. Users needing this feature now can use
>  standard Harbour builds by simply adding -kl Harbour
>  compiler flag. Old build-time macro is not supported 
>  anymore.
> 
> Modified Paths:
> --
>trunk/harbour/ChangeLog
>trunk/harbour/include/hbpp.h
>trunk/harbour/include/hbsetup.h
>trunk/harbour/src/compiler/cmdcheck.c
>trunk/harbour/src/compiler/hbusage.c
>trunk/harbour/src/pp/ppcore.c
> 
> 
> This was sent by the SourceForge.net collaborative development platform, the 
> world's largest Open Source development site.
> ___
> Harbour mailing list (attachment size limit: 40KB)
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] SF.net SVN: harbour-project:[13982] trunk/harbour

2010-02-24 Thread vszakats
Revision: 13982
  
http://harbour-project.svn.sourceforge.net/harbour-project/?rev=13982&view=rev
Author:   vszakats
Date: 2010-02-24 15:11:45 + (Wed, 24 Feb 2010)

Log Message:
---
2010-02-24 16:10 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
  * src/pp/ppcore.c
  * src/compiler/cmdcheck.c
  * src/compiler/hbusage.c
  * include/hbpp.h
  * include/hbsetup.h
* HB_USER_CFLAGS=-DHB_PP_MULTILINE_STRING feature converted
  to compiler switch '-kl'.
  INCOMPATIBLE. Users needing this feature now can use
  standard Harbour builds by simply adding -kl Harbour
  compiler flag. Old build-time macro is not supported 
  anymore.

Modified Paths:
--
trunk/harbour/ChangeLog
trunk/harbour/include/hbpp.h
trunk/harbour/include/hbsetup.h
trunk/harbour/src/compiler/cmdcheck.c
trunk/harbour/src/compiler/hbusage.c
trunk/harbour/src/pp/ppcore.c


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour