[Harbour] Re: Documentation storm on user's list

2010-06-11 Thread Adam Lubszczyk


pete_westg wrote:
 
 στις 27/05/2010 13:02, O/H Viktor Szakáts έγραψε:
 By documentation friendly code i mean two simple and very well known 
 things.
 a. Short introductory description on top of source code (in place of 
 this long and more or less useless copyright reminding replica )
 b. in-line comments.
 c. sample program.
 [OK, they are three, but any combination of two will perfectly do the 
 job ;)]
 

I think it should be MANDATORY to post comments in the sources of all PUBLIC
functions, especially type HB_FUNC() and APIs, with a description of
parameters and return.
If You do fix a function that causes a change in parameters or return that
You MUST be correcting a comment for this function.

Adam
-- 
View this message in context: 
http://harbour-devel.1590103.n2.nabble.com/Documentation-storm-on-user-s-list-tp5107834p5124785.html
Sent from the harbour-devel mailing list archive at Nabble.com.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] hb_rexexlike and hb_regexhas not work

2010-05-20 Thread Adam Lubszczyk

Hi!
Try sample:

FUNCTION main()
LOCAL reg := hb_regexcomp(.*B.*)
LOCAL cText := ABC
LOCAL x
? hb_regexlike(reg,cText)
? hb_regexhas(reg,cText)
IF VALTYPE(x:=hb_regex(reg,cText)) == A 
   ? FOUND:,x[1]
ENDIF
RETURN nil

Write: 
.F.
.F.
FOUND: ABC

Harbour ver: 2.1.0beta1 (Rev. 14520)
hbpcre.lib ver: 8.02 2010-03-19

Adam
-- 
View this message in context: 
http://harbour-devel.1590103.n2.nabble.com/hb-rexexlike-and-hb-regexhas-not-work-tp5079453p5079453.html
Sent from the harbour-devel mailing list archive at Nabble.com.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Re: Error with hb_regex()

2010-05-17 Thread Adam Lubszczyk

Hi!

I use Harbour compilator and library from MiniGui {compile also to console
mode}
(http://hmgextended.com/files/CONTRIB/)
Now I update MiniGui to 1.8.81a with Harbour version:
Harbour 2.1.0dev (Rev. 14350)
{previous version in first post Harbour 2.1.0dev (Rev. 14130)}

Now sample progam (see first post) work OK but ... if add to source any
function (used or not)
program terminated and show windows alert:
Abnormal program termination. hb_out.log not created, console not dispaly
any error.

When compile this sample in older version of MiniGUI (with Harbour version
1.1.0dev (Rev. 10630))
work OK. If copy hbpcre.lib from new MiniGUI to old and compile also work
OK.
Version of hbpcre.lib is: 7.9 2009-04-11 (get from function pcre_version())

Adam
-- 
View this message in context: 
http://harbour-devel.1590103.n2.nabble.com/Error-with-hb-regex-tp5045832p5064404.html
Sent from the harbour-devel mailing list archive at Nabble.com.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Error with hb_regex()

2010-05-13 Thread Adam Lubszczyk

Hi!

If used in procedur any function of HB_REGEX..()
it work OK, but when return from procedur application GPF.
Sample:

PROCEDURE main
 ? Test()
RETURN

FUNCTION test()
 LOCAL r , aM, t:=SAME TEST TEXT
 r:=HB_REGEXCOMP(.*(TEST).*)
 aM:=HB_REGEX(r,t)
 IF VALTYPE(aM)==A
   ? FOUND:,aM[2]
 ELSE
   ? NOT FOUND
 ENDIF
 ? hb_Version(),HB_BUILDDATE()
 INKEY(0)
RETURN OK
***
Dispaly:
 FOUND: TEST
 Harbour 2.1.0dev (Rev. 14130) Mar 11 2010 12:56:34
and wait for key. I key press aplication GPF and hb_out.log:
Application Internal Error - C:\TEST.EXE
Terminated at: 2010.05.13 14:19:58
Unrecoverable error 6005: Exception error: 

Exception Code:C005
Exception Address:004788B3
EAX:006F0748  EBX:  ECX:  EDX:006E0090
ESI:006F06B8  EDI:00486221  EBP:006CFBEC
CS:EIP:0187:004788B3  SS:ESP:018F:006CFBE8
DS:018F  ES:018F  FS:4FAF  GS:
Flags:00010217
CS:EIP: 89 43 08 89 42 04 8D 51 04 89 14 08 8B 10 8B CA
SS:ESP: 006F06A8 006CFBF8 004787EC 006F074C 006CFC04 00478109 006F074C
006CFC10 0043CA8F 006F074C 006CFC1C 00477CDC 006F0750 006CFC28 00483B37
006F0750

C stack:
EIP: EBP:   Frame: OldEBP, RetAddr, Params...
004788B3 006CFBEC   006CFBF8 004787EC 006F074C
004787EC 006CFBF8   006CFC04 00478109 006F074C
00478109 006CFC04   006CFC10 0043CA8F 006F074C
0043CA8F 006CFC10   006CFC1C 00477CDC 006F0750
00477CDC 006CFC1C   006CFC28 00483B37 006F0750
00483B37 006CFC28   006CFC34 0041449F 006F06C4
0041449F 006CFC34   006CFC40 00414EC9 006F06B8
00414EC9 006CFC40   006CFC54 0043C3C8 006F06B8 00492C30 006CFC80
0043C3C8 006CFC54   006CFC60 0042A393 006F06B8
0042A393 006CFC60   006CFC74 00440A38 006EBBAC  00492C30
00440A38 006CFC74   006CFC94 00422891 006CFC80 0001 
  0010
00422891 006CFC94   006CFD98 0041CA60  0001 0001
00493134 006CFCB8 004787EC 006EF894 006CFCD4
0041CA60 006CFD98   006CFDC0 00401180 00486218 00486184 00422864
    0002
00401180 006CFDC0   006CFDDC 0041BD5A 006E 81D729C0 
81D729C0 
0041BD5A 006CFDDC   006CFE00 00443141 0001  00486114
81D729C0 004A  005A00AC
00443141 006CFE00   006CFE30 0047FD3B 0040  81D729C0
000A  81D728EC 005C 
0047FD3B 006CFE30   006CFF78  00486114 BFF8B560 
81D728EC 005C 74736554 45584500 81D72800
 006CFF78   006CFFF4 BFF8B412 81D82490 0008 81D728EC
    


Modules:
0x0040 0x0009F000 C:\TEST.EXE
0xBFF5 0x00011000 C:\WINDOWS\SYSTEM\USER32.DLL
0xBFF2 0x00026000 C:\WINDOWS\SYSTEM\GDI32.DLL
0xBFE8 0x0001 C:\WINDOWS\SYSTEM\ADVAPI32.DLL
0xBFF7 0x00074000 C:\WINDOWS\SYSTEM\KERNEL32.DLL

Called from TEST(16) in test.prg
Called from MAIN(2) in test.prg

Application Internal Error - C:\TEST.EXE
Terminated at: 2010.05.13 14:19:59
Unrecoverable error 6005: Exception error: 

Exception Code:C005
Exception Address:004788B3
EAX:006F0748  EBX:  ECX:  EDX:006E0090
ESI:006F06B8  EDI:00486221  EBP:006CFBEC
CS:EIP:0187:004788B3  SS:ESP:018F:006CFBE8
DS:018F  ES:018F  FS:4FAF  GS:
Flags:00010217
CS:EIP: 89 43 08 89 42 04 8D 51 04 89 14 08 8B 10 8B CA
SS:ESP: 006F06A8 006CFBF8 004787EC 006F074C 006CFC04 00478109 006F074C
006CFC10 0043CA8F 006F074C 006CFC1C 00477CDC 006F0750 006CFC28 00483B37
006F0750

C stack:
EIP: EBP:   Frame: OldEBP, RetAddr, Params...
004788B3 006CFBEC   006CFBF8 004787EC 006F074C
004787EC 006CFBF8   006CFC04 00478109 006F074C
00478109 006CFC04   006CFC10 0043CA8F 006F074C
0043CA8F 006CFC10   006CFC1C 00477CDC 006F0750
00477CDC 006CFC1C   006CFC28 00483B37 006F0750
00483B37 006CFC28   006CFC34 0041449F 006F06C4
0041449F 006CFC34   006CFC40 00414EC9 006F06B8
00414EC9 006CFC40   006CFC54 0043C3C8 006F06B8 00492C30 006CFC80
0043C3C8 006CFC54   006CFC60 0042A393 006F06B8
0042A393 006CFC60   006CFC74 00440A38 006EBBAC  00492C30
00440A38 006CFC74   006CFC94 00422891 006CFC80 0001 
  0010
00422891 006CFC94   006CFD98 0041CA60  0001 0001
00493134 006CFCB8 004787EC 006EF894 006CFCD4
0041CA60 006CFD98   006CFDC0 00401180 00486218 00486184 00422864
    0002
00401180 006CFDC0   006CFDDC 0041BD5A 006E 81D729C0 
81D729C0 
0041BD5A 006CFDDC   006CFE00 00443141 0001  00486114
81D729C0 004A  005A00AC
00443141 006CFE00   006CFE30 0047FD3B 0040  81D729C0
000A  81D728EC 005C 
0047FD3B 006CFE30   006CFF78  00486114 BFF8B560 
81D728EC 005C 74736554 45584500 81D72800
 006CFF78   

Re: [Harbour] What's wrong with this define?

2010-01-26 Thread Adam Lubszczyk



Abeb wrote:
 
 
 
 #define  xlCenter   (0xEFF4)
 
 i know that it's 4294963188,  but why does it work in other languages and
 not in Harbour?
 
 

I think that Harbour use type HB_LONG defined as LONGLONG,
and LONGLONG is 64bit type

Adam
-- 
View this message in context: 
http://old.nabble.com/What%27s-wrong-with-this-define--tp27312947p27329881.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

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


Re: [Harbour] What's wrong with this define?

2010-01-25 Thread Adam Lubszczyk


Abeb wrote:
 
 
 Hi All,
 
 #define  xlCenter   (0xEFF4)
 
 OSheet:rows(1):HorizontalAlignment := xlCenter //will not work!
 
 OSheet:rows(1):HorizontalAlignment := -4108  //Will work
 
 

Simply look what show
? xlCenter

Adam
-- 
View this message in context: 
http://old.nabble.com/What%27s-wrong-with-this-define--tp27312947p27313610.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

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


[Harbour] Initialization of static variables in loaded HRB

2009-12-01 Thread Adam Lubszczyk

Hi Przemek !

When the module HRB (or pcode-DLL) is loaded dynamically , You are looking
for whether it was once used a similar table of symbols, and then it
recycled.
If it is recycled, then You do not initialize static variables.
There is a problem to perform re-initialization ?

Lack of initialization of static variables, of course, provides additional
possibilities, but I think only the EXTRA. Normally, I expect that re-loaded
the module will behave just like the first time.
There are also other problems, such as when we have different versions of
the same function, and in the program we load modules several times.
Sample:
 hrb1.prg - hrb1.hrb 
FUNCTION abc()
LOCAL x:=HRB1: ++2 from init static 30 - Now is:
STATIC y:=30
y:=y+VAL(2)
RETURN x+STR(y,5)

 hrb2.prg - hrb2.hrb 
STATIC z:=70
FUNCTION abc()
LOCAL x:=HRB2: --3 from 70 initalized. Now is: 
LOCAL w:=VAL(2)
LOCAL s:= plus 
s:=s+extra 
z:=z-w
--z
s:=s+string :)
RETURN x+STR(z,5)+s

 main.prg - main.exe 
PROCEDURE MAIN
LOCAL i,hh
FOR i:=1 TO 2
  ? HRB1 load by #,i
  hh:=HB_HRBLOAD(hrb1.hrb)
  ? ABC()-,(ABC())
  ? ABC()-,(ABC())
  ? HBR1 unload #,i
  HB_HRBUNLOAD(hh)
  ? HRB2 load by #,i
  hh:=HB_HRBLOAD(hrb2.hrb)
  ? ABC()-,(ABC())
  ? ABC()-,(ABC())
  ? HBR2 unload #,i
  HB_HRBUNLOAD(hh)
NEXT
RETURN
**

We obtain the result:

HRB1 load by #  1
ABC()- HRB1: ++2 from init static 30 - Now is:   32
ABC()- HRB1: ++2 from init static 30 - Now is:   34
HBR1 unload #  1
HRB2 load by #  1
ABC()- HRB2: --3 from 70 initalized. Now is:31 plus extra string :)
ABC()- HRB2: --3 from 70 initalized. Now is:28 plus extra string :)
HBR2 unload #  1
HRB1 load by #  2
ABC()- HRB1: ++2 from init static 30 - Now is:   30
ABC()- HRB1: ++2 from init static 30 - Now is:   32
HBR1 unload #  2
HRB2 load by #  2
ABC()- HRB2: --3 from 70 initalized. Now is:29 plus extra string :)
ABC()- HRB2: --3 from 70 initalized. Now is:26 plus extra string :)
HBR2 unload #  2

Strange result is not it?
HRB2 get static value from HRB1 and vice versa !!!

Przemek, maybe can You add options to HB_HRBLOAD () which will force a
re-initialization of static variables like: hb_hrbload( HB_HRB_INIT_STATIC,
hrb.hrb)
or better: hb_hrbload(hrb.hrb) normal and: hb_hrbload(
HB_HRB_NO_INIT_STATIC, hrb.hrb) extra feature.

Adam
[ translation into English with the help of Google :) ]

-- 
View this message in context: 
http://old.nabble.com/Initialization-of-static-variables-in-loaded-HRB-tp26596357p26596357.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

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


[Harbour] STATIC variables in HRB and PCODE DLL

2009-11-12 Thread Adam Lubszczyk

Hi!

Sample code:
** hrbcode.prg (or PCODE dll) *
FUNCTION abc()
STATIC x:=99
++x
RETURN x
*** main.prg **
PROCEDURE main()
LOCAL i,h
FOR i:=1 TO 3
  h:=HB_HRBLOAD(hrbcode.hrb)
  ?? (abc())
  ?? (abc())
  HB_HRBUNLOAD(h)
NEXT

Show:
  100  101  102  103  104  105
I wont work as:
  100  101  100  101  100  101

Is option for HB_HRBLOAD() (also HB_LIBLOAD() for dll) that always
reinitalize static variables ?

Adam
-- 
View this message in context: 
http://old.nabble.com/STATIC-variables-in-HRB-and-PCODE-DLL-tp26315403p26315403.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] STATIC variables in HRB and PCODE DLL

2009-11-12 Thread Adam Lubszczyk


Viktor Szakáts wrote:
 
 Why not add an explicit init function to reinit that 
 variable whenever you need it?
 
OK I may add extra init function (And MUST remember write it), but why, if
it already exists function HB_FUNC_INITSTATICS(). 
The problem is that it is invoked only once.
That behavior is very confusing.
Sample, first men wirte module:
*** mod1.prg  - mod1.hrb ***
FUNTION ABC()
STATIC x:=99
++x
RETURN x
*
and second men write module:
 mod2.prg - mod2.hrb
FUNCTION ABC()  // SAME NAME !!!
STATIC y:=59 // NOT X but Y !!!
y++
RETURN y
**
Now I in my MAINPROGRAM get from script names of modules and functions and
do:
***
h:=HB_HRBLOAD(module1)  // mod1.hrb
 ? (funcname1)// abc()   - 100   OK
 ? (funcname1)- 101   OK
HB_HRBUNLOAD(h)
// same code
h:=HB_HRBLOAD(module2)  // mod2.hrb
 ? (funcname2)// abc()- 102 !?!
 ? (funcname2) - 103 !?! 
HB_HRBUNLOAD(h)




 IMO it's not the job of HRB engine to solve such programming tasks.
 Such setting has not much point 
 anyway as you may have multiple STATIC vars with 
 different init requirement inside on .hrb. Moreover 
 it makes your code dependent on the way its 
 invoked/loaded.
 
But just to add an option that every time you load the module HRB will
perform
the functions HB_FUNC_INITSTATICS().

Adam
-- 
View this message in context: 
http://old.nabble.com/STATIC-variables-in-HRB-and-PCODE-DLL-tp26315403p26319000.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

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


Re: [Harbour] How to create and use DLL like HRB

2009-10-23 Thread Adam Lubszczyk

Hi!
Since nobody answered, I did many tests and trials.
It may be useful to someone.

Task: the chance to join a dynamic extra functions.

Here are the results of my tests at Harbour 2.0.0beta1 (from
http://sourceforge.net/projects/harbour-project/files/binaries-windows/2.0.0beta1/harbour-2.0.0beta1-win.exe/download)
and BCC55 on Windows98SE :) and build simple console application.

First, we must distinguish types of the MainPrg applications:
-“Normal - normally compiled with a set of standard libraries
 harbour.exe MainPrg.prg –n
 bcc32.exe –WC –I… -L… MainPrg.c  gtwi.lib compiler.lib rtl.lib vm.lib
other.lib
- HDll - compiled for use harbour.dll (harbour-20-bcc.dll)
 harbour.exe MainPrg.prg –n
 bcc32.exe –WC –I… -L… MainPrg.c  harbour-20-bcc.lib hbmainstd.lib

If an additional module contains only PCODE (prg) functions the best
compilations to module type HRB. You load the module using HB_HRBLOAD() and
can refer directly to the function (with macros) or via HB_LIBDO()
Module type HRB:
+ very easy to build (harbour.exe module.prg –n1 –gh )
+ very small file
- only PCODE (prg) function (not C extension)
All used standard and MainPrg functions must declare in the module by typing
DYNAIMC list_of_function
If you are creating MainPrg type standard, all used in module standard
function must be linked to MainPrg (You can add all Harbour functions by
#include hbextern.ch”).

Create and use a module type DLL.
You load the module using HB_LIBLOAD() and can refer directly to the
function (with macros) or via HB_LIBDO()

If MainPrg is type “HDLL” You make module.dll by:
 harbour.exe module.prg –n1
 bcc32.exe –WD –I… -L… module.c  hbmaindllp.lib

Since the sources of hbmaindllp.lib have error, You can not use the blocks
in C.
All API functions like hb_parc() use:
FARPROC pParC = GetProcAddress( GetModuleHandle( NULL ), _hb_parc );
instead of
FARPROC pParC = hb_getProcAddress( _hb_parc );
(static function hb_getProcAddress()looks function in harbour-20-bcc.dll ) 
To work OK You must copy source of hbmaindllp.c to Your module and correct
all this function. Now compile by
bcc32.exe –WD –I… -L… module.c

If the MainPrg is normal need more work.
MainPrg must export some functions.
For PCODE hb_vmExecute and hb_vmProcessSymbolsEx (or
hb_vmProcessSymbols, check definition HB_INIT_SYMBOLS_EX_END in hbinit.h
– new SVN Harbour use “hb_vmProcessSymbols”) sample:
//***
#pragma BEGINDUMP
#include windows.h
#include hbapi.h
PHB_SYMB __declspec(dllexport) forDll_hb_vmProcessSymbolsEx( PHB_SYMB
pSymbols, USHORT uiSymbols, const char * szModuleName, ULONG ulID, USHORT
uiPcodeVer )
{
/*  DYNLIB version */  
  return hb_vmProcessDynLibSymbols( pSymbols, uiSymbols, szModuleName, ulID,
uiPcodeVer ) ;
}

void __declspec(dllexport) forDll_hb_vmExecute( const BYTE * pCode, PHB_SYMB
pSymbols )
{
   hb_vmExecute(  pCode,  pSymbols ) ;
}
#pragma ENDDUMP
//

and to module include sample code:
//**
#pragma BEGINDUMP
#include windows.h
typedef PHB_SYMB ( * VM_PROCESS_SYMBOLS_EX ) ( PHB_SYMB pSymbols, USHORT
uiSymbols, const char * szModuleName, ULONG ulID, USHORT uiPcodeVer );
typedef void ( * VM_EXECUTE ) ( const BYTE * pCode, PHB_SYMB pSymbols );
/* or #include hbtypes.h /*
static PHB_SYMB hb_vmProcessSymbolsEx( PHB_SYMB pSymbols, USHORT uiSymbols,
const char * szModuleName, ULONG ulID, USHORT uiPcodeVer )
{
   static FARPROC s_pProcessSymbols = NULL;
   PHB_SYMB pModuleSymbols = NULL;
   if( !s_pProcessSymbols )
  s_pProcessSymbols = GetProcAddress( NULL ,
_forDll_hb_vmProcessSymbolsEx );
   if( s_pProcessSymbols )
  pModuleSymbols = ( ( VM_PROCESS_SYMBOLS_EX ) s_pProcessSymbols )
 ( pSymbols, uiSymbols, szModuleName, ulID, uiPcodeVer
);
   return pModuleSymbols;
}

static void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
{
   static FARPROC s_pExecute = NULL;
   if( !s_pExecute )
  s_pExecute = GetProcAddress( NULL , _forDll_hb_vmExecute );
   if( s_pExecute )
  ( ( VM_EXECUTE ) s_pExecute )( pCode, pSymbols );
}
#pragma ENDDUMP
//*

If there are functions in C using the Harbour API, You have the same in
MainPrg export them and in a DLL module to import.
If the function in C is not even once used in PCODE module, it must be
declared in PCODE module using the EXTERNAL

Adam
(Sorry for my English.)


-- 
View this message in context: 
http://www.nabble.com/How-to-create-and-use-DLL-like-HRB-tp25698377p26026069.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] How to create and use DLL like HRB

2009-10-01 Thread Adam Lubszczyk

Hi!

In my program, I want to allow users to add their modules.
This works very well with the modules in the HRB.
However, in modules HRB can not add blocks in C (for example, inserts the
code referring APIs ).
I found information that can be just as HRB, use DLLs.
In message: 
http://www.nabble.com/Pcode-and-hb_LibDo%28%29...-what-has-changed--td11161011.html
http://www.nabble.com/Pcode-and-hb_LibDo%28%29...-what-has-changed--td11161011.html
 
You write that use HB_LIBLOAD() function, and found the sample programs.
But this sample not work (may be I wrong compiling it ?).
Therefore, I looked to the sources HB_LIBLOAD() function.
This function only loads the library (API LoadLibrary() ) and attempts to
perform functions such INIT.
So, I think I have to put yourself in the library operations that add to an
array of symbols the new my functions, and do it during the loading library
using the APIs DllEntryPoint() function.

So please give examples of sources program and librarie and how they build
(options for BCC32 and ILINK32).
-- 
View this message in context: 
http://www.nabble.com/How-to-create-and-use-DLL-like-HRB-tp25698377p25698377.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Same idea for console program in Windows 98

2009-06-09 Thread Adam Lubszczyk

Hi!

Same time ago I wrote that console Harbour aplication in Windows 98 work
very slow when must dispaly any text.

So, look You this sample program (it work in normal not multithread mode
Harbour )

//** START

PROCEDURE main
LOCAL i,t
LOCAL xx:=  
CLS
t:=SECONDS()
FOR i:= 1 TO 1   // ONLY 10,000
  @ 0,0 SAY Normal
  @ 0,30 SAY i
NEXT
@ 0,40 SAY SECONDS()-t
@ 1,0 SAY GET: GET xx
READ

DISPBEGIN()
AutoConsoleRefresh()  //default 50ms

t:=SECONDS()
FOR i:= 1 TO 100// 1,000,000  !!!
  @ 2,0 SAY DISPBEGIN + AutoRefrash 50ms
  @ 2,30 SAY i
NEXT
@ 2,40 SAY SECONDS()-t
@ 3,0 SAY GET 50ms: GET xx
READ

AutoConsoleRefresh(200)   //set 200ms
t:=SECONDS()
FOR i:= 1 TO 100// 1,000,000  !!!
  @ 4,0 SAY DISPBEGIN + AutoRefrash 200ms
  @ 4,30 SAY i
NEXT
@ 4,40 SAY SECONDS()-t
@ 5,0 SAY GET 200ms: GET xx
READ
@ 6,0 SAY GET 200ms with DISPEND(): GET xx
DISPEND() ; READ ; DISPBEGIN()

AutoConsoleRefresh(0)  //OFF and kill thread
DISPEND()

RETURN
*
*
#pragma BEGINDUMP

#include windows.h

#include hbapi.h
#include hbapigt.h

//***
DWORD  MyThreadProc( LPDWORD lpParameter )
{
  static DWORD nWait ;
  static BOOL lLoop = TRUE ;
  static BOOL lRun = FALSE ;
  if ( !(*lpParameter) )
  {
 lLoop = FALSE ;
  }
  else
  {
 nWait = (DWORD) *lpParameter ;
 lLoop =  TRUE ;
 if ( !lRun )
 {
lRun = TRUE ;
while ( lLoop )
{
   Sleep( nWait );
   if ( hb_gtDispCount() == 1 )
   {
  hb_gtDispEnd() ;
  hb_gtDispBegin() ;
   }
}
lRun = FALSE ;
 }
  }
  return 0 ;
}
//**

HB_FUNC ( AUTOCONSOLEREFRESH )
{
  static HANDLE hThread = NULL ;
  DWORD  ThreadId ;
  static DWORD  nWait = 50 ;
  static lRun = FALSE ;
  if ( HB_ISNUM( 1 ) )
  {
 nWait = (DWORD) hb_parnl( 1 ) ;
  }
  else
  {
 nWait = 50 ;//default value
  }
  if ( nWait  0 )//  0
  {
if ( lRun )
 {
   MyThreadProc(nWait) ;   //send new value
 }
 else
 {//make thread
   hThread = CreateThread(NULL, NULL,
  (LPTHREAD_START_ROUTINE) MyThreadProc ,
  nWait, NULL, ThreadId);
   lRun = !(hThread == NULL) ;
   hb_retl( lRun ) ;
 }
  }
  else  //nWait = 0
  {
 if ( nWait==0lRun )
 {
   ThreadId = 0 ;
   MyThreadProc(ThreadId) ;   //send info break loop
   WaitForSingleObject(hThread, INFINITE ) ; //wait for end thread
   lRun = FALSE ;
   CloseHandle(hThread) ;
   hThread = NULL ;
   hb_retl( TRUE ) ;
 }
 else
 {
   hb_retl( FALSE ) ;
 }
  }
}

#pragma ENDDUMP

// END 

On my Windows 98SE I get result: (look so normal count only 10.000, 
refresh 1.000.000)
  normal refresh 50msrefresh 200ms
Window 62,89 4,784,72
Window+key   21,36 7,319,34
FullScreen   3,84 4,774,73
FullScreen+key  135,89   13,45  11,53
key- pressed any key

GET with 200ms is not good (freeze) but in 50ms work OK.

I get same probelm in code:
  if ( hb_gtDispCount() == 1 )
  {
 hb_gtDispEnd() ;
 hb_gtDispBegin() ;
  }
after hb_gtDispCount() and before hb_gtDispEnd() aplication can
also call DISPEND() and ... thread set extra DISPBEGIN() , I don't know how
protect this.

Adam
-- 
View this message in context: 
http://www.nabble.com/Same-idea-for-console-program-in-Windows-98-tp23946398p23946398.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Timer

2009-05-11 Thread Adam Lubszczyk

Hi!

Can I define in Harbout timer ?

Like:
PROCEDURE main
LOCAL hTimer:=hb_TimerNew( {|hT|MyProc(hT)} , 1000)  //call in 1000ms cycle
MyProc()
hb_TimerStart(hTimer)   // enable timer
...
...
hb_TimerStop(hTimer)// disable timer
hb_TimerDelete(hTimer)  //destroy timer
RETURN
//
PROCEDURE MyProc(hTr)
hb_TimerStop(hTr)
...
hb_TimerStart(hTr)
RETURN


Adam
-- 
View this message in context: 
http://www.nabble.com/Timer-tp23482401p23482401.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] How can i replace module getsys?

2009-04-29 Thread Adam Lubszczyk

Hi!

Massimo Belgrano-3 wrote:
 
 How can i replace module getsys?
 i have simply passed to hbmk2 my personalised getsys.prg (basically
 from original getsys)
 

Copy source getsys.prg to Your program folder.
Modify it,  do not delete not modifed function from source
(in your copy of getsys.prg must be all function from original).
To Your program add line: SET PROCEDURE TO getsys.prg 

Adam
-- 
View this message in context: 
http://www.nabble.com/How-can-i-replace-module-getsys--tp23282710p23291515.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Open index with unknow function or variable

2009-04-24 Thread Adam Lubszczyk

Hi!

Przemyslaw Czerpak-2 wrote:
 
 In Harbour I get error Undefined function FUNCTIONX or Variable does
 not
 exist: VARIABLEX
 WHY ?
 
 Because Harbour checks if all index expressions (KEY/FOR) are valid when
 index is open. It helps to detect problem immediately. IMHO it's much
 better then later pseudo random RTE like in Clipper.
 
 

Can I switch this feature (checks when _OPEN_ index ) to OFF ?
I must often read existing bases and indexes. I am aware of limitations.
Sample, I want open base from VFP and index with many TAGs, but
I use only one TAG correct read by Harbour and I use only seek and skip.


Adam
-- 
View this message in context: 
http://www.nabble.com/Open-index-with-unknow-function-or-variable-tp23190859p23210753.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Open index with unknow function or variable

2009-04-23 Thread Adam Lubszczyk

Hi!
Thera are BASE.DBF and BASE.NTX with key  FunctionX(Field1)  or key:
Field1+VariableX

Make same program with line:
  USE base INDEX base

In Clipper it is  OK, I open base with index.
In Harbour I get error Undefined function FUNCTIONX or Variable does not
exist: VARIABLEX
WHY ?
I need FunctionX() or VariableX _only_ if I modify or append record.
Maybe I wont only skip by order or seek in base.
If key is sample Func1(Field1)+Func2(Field2)+VariableX, 
I can seek by: DBSEEK( MyFuncEmulateKeyValue() ), I not need Func1(),
Func2() and VariableX

Adam
-- 
View this message in context: 
http://www.nabble.com/Open-index-with-unknow-function-or-variable-tp23190859p23190859.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Visual FoxPro incompatibility

2009-04-21 Thread Adam Lubszczyk

Hi!

Massimo Belgrano-3 wrote:
 
 I have post on sybase [x]harbour newgroupI can't test because i am using
 v8
 are you using acelib,rddads created from ads v9?
 

I tested with ace32.dll, adsloc32.dll ver 7 on Windows 98SE
and ace32.dll, adsloc32.dll ver 9 on Windows XP
Sample base and index was created in VFP 6


Massimo Belgrano-3 wrote:
 
 Can you explain codepage problem?
 

Normal I use:
 REQUEST HB_CODEPAGE_PL852
 REQUEST HB_CODEPAGE_PLWIN
 HB_SETCODEPAGE(PL852)  //program and dispaly codepage
 USE base NEW CODEPAGE PLWIN  //auto translate PLWIN - PL852

In ADS: 
 USE base NEW CODEPAGE PLWIN //open but not translate

Adam
-- 
View this message in context: 
http://www.nabble.com/Visual-FoxPro-incompatibility-tp11612841p23152836.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Visual FoxPro incompatibility

2009-04-20 Thread Adam Lubszczyk


Przemyslaw Czerpak-2 wrote:
 
 [...]
 But it's a free project and if someone is interested then he can make it.
 In such case I would like to ask to not add such functionality to core
 code
 but create new RDD in contrib.
 
 best regards,
 Przemek
 

Jesli bym potrafil, to moze bym zrobil :)
If I can, maybe I do it


Massimo Belgrano-3 wrote:
 
 Only a note
 ads v 9 use  visual fox pro 9 data and index and run in win 32-64- and
 Linux
 
  ADS9 has provided support for FoxPro tables and CDX/IDX indexes for
 a long time, ADS 9 has added full support for Visual FoxPro tables,
 including auto-increment, date/time, and VarChar fields. Advantage can
 use its proprietary, high-performance locking with Visual FoxPro
 tables, but also supports a compatibility mode, permitting legacy
 applications that access the Visual FoxPro tables directly to co-exist
 with newer, Advantage-based applications. Advantage adds the new
 ADS_VFP table type for this support.
 [...]
 
 -- 
 Massimo Belgrano
 
 

I try it.
Open Visual FoxPro CDX, but if index is on field type INTEGER not work :(

Adam

-- 
View this message in context: 
http://www.nabble.com/Visual-FoxPro-incompatibility-tp11612841p23134381.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Visual FoxPro incompatibility

2009-04-17 Thread Adam Lubszczyk

Hi Przemek, You same time ago write:

Przemyslaw Czerpak wrote:
 
 On Mon, 16 Jul 2007, Enrico Maria Giordano wrote:
 [...]
 It's not necessary. This CDX file uses Windows unicode collation function
 to hash index keys. The index key size is twice longer and is unreadable
 (check ordKeyVal()). Such indexes can be created and used only in Windows
 because MS haven't documented the collation algorithm and as usual it's
 not
 compatible with Unicode standards. So I decided to not add support for
 such
 indexes. If you need to use them in [x]Harbour then you can hack DBFCDX
 and
 hash index keys with this function but it will work only in W32 - such
 modifications should not take more then few lines.
 
 best regards,
 Przemek
 ___
 
 

Maybe You make new RDD VFP for Visual FoxPro CDX indexes as hacked DBFCDX
?

Adam

-- 
View this message in context: 
http://www.nabble.com/Visual-FoxPro-incompatibility-tp11612841p23094727.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] TBrowse bug

2009-04-14 Thread Adam Lubszczyk

Hi!

Make TBrowseDB with 10 rows to display.
Move cursor down and stay sample on 5th row.
Do:
DBGOTO(2)
oBrows:RefreshAll()
DO WHILE !oBrows:stabilize(); ENDDO

TBrowsDB dispaly data from 1 to 10 records BUT cursor not move up to row 2nd
(and record 2) but still stay in 5th row and record set to 5th

Adam
PS.
Once I tested this in xHarbour, its work OK
-- 
View this message in context: 
http://www.nabble.com/TBrowse-bug-tp23033851p23033851.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] TBrowse bug

2009-04-14 Thread Adam Lubszczyk

Hi!

Viktor Szakáts wrote:
 
 Hi Adam,
 
 How does it work in Clipper?
 Could you post a working example to demonstrate it?
 
 The one I created based on your description did the
 exact same thing in both Clipper and Harbour.
 
 Brgds,
 Viktor
 
 

I'm sorry, You are right!
I often use DBU where cursor move correct. Now I look to source DBU and 
see, so I must self correct position cursor in TBrowse.

Thank You for Your quick ansfer.
Adam
-- 
View this message in context: 
http://www.nabble.com/TBrowse-bug-tp23033851p23034893.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] EXE form Harobur on Novell Netware 4 not colsed

2009-04-13 Thread Adam Lubszczyk

Hi!

I make sample EXE with Harbour and BCC55.
When I copy it on server Novell Netware 4.11 and run from workstatin
with Windows XP work and ending OK, but file EXE not closed
(server console show so EXE is still open by workstation).
How correct exit from aplication to close opened EXE ?


Adam
-- 
View this message in context: 
http://www.nabble.com/EXE-form-Harobur-on-Novell-Netware-4-not-colsed-tp23033351p23033351.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Index with to long field name.

2009-04-07 Thread Adam Lubszczyk

Hi!

Przemyslaw Czerpak-2 wrote:
 
 For memvars (public and private variables) they can make some
 RT tricks like:
proc main()
   public myvar1_localdata := abc
   public myvar1_loc := iif( .t., @myvar1_localdata, )
 
 
But this trick not work with field :(
PUBLIC LongFieldName := IIF(.T., @LONGFIELDN,)  // error not variable
LONGFIELDN
I try open original (not create by my) index CDX (inside index is long filed
name)

Adam 
PS.
Can Harbour open (only for read) index CDX from Visual FoxPro 6?
I get: Error DBFCDX/1012  Corruption detected.

-- 
View this message in context: 
http://www.nabble.com/Index-with-to-long-field-name.-tp22845515p22924886.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Index with to long field name.

2009-04-03 Thread Adam Lubszczyk



Adam Lubszczyk wrote:
 
 Hi!
 Problem:
 In Clipper or FoxPro samebody create index like:
 INDEX ON Name_and_Last TO xxx
 but field name in DBF is 'NAME_AND_L'.
 In Clipper and FoxPro it's work OK
 but Harbour when open index show error:
 variable 'Name_and_Last' not found.
 (in index file key is 'Name_and_Last' )
 
 How open and work with this index in Harbour ?
 
 Adam
 

Hi Harbour Team!

Mayby You add Alias Symbol like:
SETALIAS VariableWithLongName FOR VariableWi
SETALIAS FunctionWithLongName() FOR  FunctionWi()
SETSHORTALIAS VariableWithLongName , FunctionWithLongName() //auto set alias
for 10 lenght original

Now, VariableWithLongName and VariableWi on the same variable,
FunctionWithLongName() and FunctionWi() on the same function.

Adam
-- 
View this message in context: 
http://www.nabble.com/Index-with-to-long-field-name.-tp22845515p22865074.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Index with to long field name.

2009-04-02 Thread Adam Lubszczyk

Hi!
Problem:
In Clipper or FoxPro samebody create index like:
INDEX ON Name_and_Last TO xxx
but field name in DBF is 'NAME_AND_L'.
In Clipper and FoxPro it's work OK
but Harbour when open index show error:
variable 'Name_and_Last' not found.
(in index file key is 'Name_and_Last' )

How open and work with this index in Harbour ?

Adam
-- 
View this message in context: 
http://www.nabble.com/Index-with-to-long-field-name.-tp22845515p22845515.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

___
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour