procedure mainI built it on my Ubuntu Maverick Linux 64 bit system, using a built-from-source Harbour 3.0.0 install, with these commands:
clear
@ 5,10 say "You should see this."
scrn = savescreen()
@ 6,10 say "You should NOT see this"
restscreen(scrn)
dummy = " "
@ 7,10 get dummy
read
HB_FUNC( RESTSCREEN )Yes, when I run the rebuilt test.prg with this modified code, egad.txt does indeed get created and filled with the word "nope." SO... whatever it is that HB_ISCHAR(5) does, it's coming back FALSE and the function is a no-op. It raises no error indication otherwise.
{
if( HB_ISCHAR( 5 ) )
{
int iTop, iLeft, iBottom, iRight;
HB_BOOL fNoCheck = HB_FALSE;
hb_getScreenRange( &iTop, &iBottom, fNoCheck, HB_TRUE );
hb_getScreenRange( &iLeft, &iRight, fNoCheck, HB_FALSE );
hb_gtRest( iTop, iLeft, iBottom, iRight, hb_parc( 5 ) );
} else {
FILE *fp;
fp = fopen("egad.txt","w");
fprintf(fp, "nope\n");
fclose(fp);
}
}
HB_FUNC( HB_ISCHAR )Working with context clues, it appears that the value 5 in the call in RESTSCREEN is being treated as a binary value (see the bitwise and &) which is binary 101. Assuming I'm not misunderstanding what hb_parinfo(1) does... I'm assuming it's extracting the value of the first parameter, which is 5. Possibly I have that wrong.
{
hb_retl( ( hb_parinfo( 1 ) & ( HB_IT_MEMO | HB_IT_STRING ) ) == HB_IT_STRING );
}
#define HB_IT_STRING ( ( HB_TYPE ) 0x00400 )Now, this is nuts. HB_IT_MEMO is defined in terms of HB_IT_STRING, so the code in HB_ISCHAR is a bit odd... HB_IT_MEMO | HB_IT_STRING is exactly the same as HB_IT_MEMO, and after bitwise anding it with the result of hb_parinfo(1), we check to see if it is exactly equal to HB_IT_STRING. If for some reason the result of hb_parinfo(1) were equal to HB_IT_MEMO, then the result of this comparison to HB_IT_STRING would be FALSE. So why bother with HB_IT_MEMO at all?
#define HB_IT_MEMOFLAG ( ( HB_TYPE ) 0x00800 )
#define HB_IT_MEMO ( HB_IT_MEMOFLAG | HB_IT_STRING )
I don't have Clipper documentation available, just the docs on the
Harbour website and my copy of the FlagShip manual. As you can see, I
got a ways into the source code... I'm sure I'd have figured it out
eventually.
Thanks!
-- Chris.
> http://www.ousob.com/ng/sum87/ng26423.php
^^^^^
It's a link to Clipper Summer'87 NG.
It should be http://www.ousob.com/ng/clguide/ng5fc0d.php and here we
can see:
/----
If you specify no coordinates, the entire screen (i.e., from 0,0 to
MAXROW(), MAXCOL()) is saved.
\----
For restscreen we have got http://www.ousob.com/ng/clguide/ng5ce37.php
and:
/----
If the
<cScreen> was saved without coordinates to preserve the entire screen,
no screen coordinates are necessary with RESTSCREEN().
\----
That way screen coordinates in Clipper 5.x are optional so this code:
scrn := savescreen()
restscreen(scrn)
should be valid and give the same results for both Flagship and Clipper
5.x, I think. Am I wrong?
--
Regards from The Harbour Project mirror in Poland
Andrzej P. Woźniak
------
Hosting klatka.pl 4GB za jedyne 40 zl za rok i domena gratis
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-users+unsubscribe@googlegroups.com
Web: http://groups.google.com/group/harbour-users
Hi,
> AHA. So. If the SAVESCREEN() and RESTSCREEN() functions were in
> the documentation (I couldn't find them on the Harbour website), I'd
> have instantly seen the problem.
> I don't have Clipper documentation available, just the docs on the
> Harbour website and my copy of the FlagShip manual. As you can see,
> I got a ways into the source code... I'm sure I'd have figured it
> out eventually.
FSMAN is all what you need in such case.
From FlagShip manual:
Syntax 1:
NIL = RESTSCREEN ([expN1], [expN2], [expN3], [expN4], varS5)
Syntax 2:
NIL = RESTSCREEN (varS5)
[...]
Compatibility:
[...]
Syntax 2 is not supported by C5.
So it's documented in FSMAN that this syntax is local FlagShip extension.
Unlike some unintentional incompatibilities in FS, extensions like above
are usually well documented. Always check compatibility section.
best regards,
Przemek
Or in other words, I wasn't actually wrong to expect that to work.
Changing the RTL source should be easy enough, now that I see how it is
supposed to work... or I can just go with the coordinates throughout my
codebase. Hmm. Easier to fix the RTL. Who do I submit patches to?
-- Chris.
Dunno. Never really did "real" Clipper 5; went from Summer '87 to
Quicksilver to FlagShip. I'm all messed up.
-- Chris.
http://www.itlnet.net/programming/program/Reference/c53g01c/menu.html
Yes you are. Read above documentation again where all is correctly
explained:
RESTSCREEN( [<nTop>], [<nLeft>],
[<nBottom>], [<nRight>], <cScreen> ) -> NIL
You may omit coordinates in RESTSCREEN() function but you have
to put screen buffer in the 5-th parameter.
so restscreen(scrn) was never supported by any clipper, clip, xbase++,
[x]Harbour versions and only restscreen(,,,,scrn) works.
restscreen(scrn) is local FlagShip extension and it is documented in
FlagShip documentations (FSMAN).
best regards,
Przemek
> Hmm... or did this functionality change between Clipper 5.0 and the 5.2
> version those docs are for?
Easy to check:
The problem is that FlagShip extended RESTSCREEN()to accept the buffer as first parameter, while in Harbour/Clipperin must be 5th.
The rest of what I wrote stays true, FS_RESTSCREEN()could be implemented which would accept FS compatibleparameter/behavior extensions.