David, Przemyslaw,

I'm sorry, I was not monitoring this list lately because of lack of spare
time, anyway, can I do to help?

It seems you did focus on mouse code, I've never dealt with it, but I'd say it
has to do with openwatcom, because with GCC mttest*.* work ok.

If I'm not wrong, openwatcom development, at least for os/2, has been stopped.
Why are you trying to use it?

Maurilio.

David Arturo Macias Corona wrote:
>>> is executed but screen is not refreshed with tracing labels on it
>>> I was catching and error DISAPPEAR applying in hb_gt_os2_ReadKey():
>>>    /*   KbdCharIn( s_key, IO_NOWAIT, ( HKBD ) * s_hk ); */
>>> As you said, fail reading keyboard input except thread 1  :-)
> 
>>we will have to find why it happens. Maybe Maurilio can help.
> 
> Maurilio, help !
> 
>>> ... and screen/output is not updated ?
> 
>>??? I do not understand. Do you want to say that only 1-st thread can
>>display data on the screen?
> 
> Good question but I am not tested that
> 
> What I say is: using gtos2, at least in these tests, screen/output is
> not refreshed and tracing labels existent in body of fuction where error
> happen are not shown
> You will see more samples below
> 
>>>       if( kbhit() )
>>>          ch = getch();
> 
>>Probably kbhit() internally call KbdCharIn() and it's exactly
>>the same problem.
> Maybe
> 
>>If possible then I would like to check if other GTOS2 functions works
>>correctly for 2-nd thread and the problem is only with KbdCharIn().
>>F.e. try mttest02.prg with such modified GTOS2 so we can see if screen
>>output works.
> 
> I was trying with mttest02.prg and we got many results
> Note: I am not testing if "screen output works" with 2nd thread but
> entire execution of program
> 
> For now we have in gtos2.c
>    /*   KbdCharIn( s_key, IO_NOWAIT, ( HKBD ) * s_hk ); */
> 
> and mttest02.exe results:
> ----------------
> 1. hb_gt_def_InkeyPollDo()
> 0. hb_gt_os2_ReadKey()
> 1. hb_gt_os2_ReadKey()
> 2. hb_gt_os2_ReadKey()
> 3. hb_gt_os2_ReadKey()
> 4. hb_gt_os2_ReadKey()
> 1. hb_gt_def_MouseReadKey()
> SYS1808:
> The process has stopped.  The software diagnostic
> code (exception code) is  0001.
> ----------------
> 
> Using replacement for HB_GTSELF_MOUSEISPRESENT( pGT ):
> 
>    printf("1. hb_gt_def_MouseReadKey()\r\n");fflush(stdout);
>    /* if( HB_GTSELF_MOUSEISPRESENT( pGT ) ) */
>    if( hb_gt_def_MouseIsPresent( pGT ) )
> 
> and mttest02.exe results:
> ----------------
> 4. hb_gt_os2_ReadKey()
> 1. hb_gt_def_MouseReadKey()
> 10. hb_gt_def_MouseReadKey()
> SYS1808:
> The process has stopped.  The software diagnostic
> code (exception code) is  0001.
> ----------------
> 
> so error happen trying HB_GTSELF_MOUSEISPRESENT( pGT )
> 
> Using
>    printf("1. hb_gt_def_MouseReadKey()\r\n");fflush(stdout);
>    if( HB_GTSELF_MOUSEISPRESENT( pGT ) )
>    /* if( hb_gt_def_MouseIsPresent( pGT ) ) */
> 
> and
> 
> static BOOL hb_gt_os2_mouse_IsPresent( PHB_GT pGT )
> {
>    printf("1. hb_gt_os2_mouse_IsPresent()\r\n");fflush(stdout);
>    HB_SYMBOL_UNUSED( pGT );
>    printf("2. hb_gt_os2_mouse_IsPresent()\r\n");fflush(stdout);
>    return s_uMouHandle != 0;
> }
> 
> and mttest02.exe results:
> ----------------
> 4. hb_gt_os2_ReadKey()
> 1. hb_gt_def_MouseReadKey()
> 1. hb_gt_os2_mouse_IsPresent()
> 2. hb_gt_os2_mouse_IsPresent()
> SYS1808:
> The process has stopped.  The software diagnostic
> code (exception code) is  0001.
> ----------------
> 
> so hb_gt_os2_mouse_IsPresent( ) is working fine
> 
> Using in hb_gt_def_MouseReadKey( )
> 
>       /* if( iEventMask & INKEY_LDOWN && HB_GTSELF_MOUSEBUTTONPRESSED(
> pGT, 0, &iRow, &iCol ) ) */
>       if( iEventMask & INKEY_LDOWN && hb_gt_def_MouseButtonPressed( pGT,
> 0, &iRow, &iCol ) )
> 
> and mttest02.exe results:
> ----------------
> 1. hb_gt_os2_mouse_IsPresent()
> 2. hb_gt_os2_mouse_IsPresent()
> 8. hb_gt_def_MouseReadKey()
> SYS1808:
> The process has stopped.  The software diagnostic
> code (exception code) is  0001.
> ----------------
> 
> which belong to:
> 
>          printf("8. hb_gt_def_MouseReadKey()\r\n");fflush(stdout);
>          HB_GTSELF_MOUSEGETPOS( pGT, &iRow, &iCol );
>          printf("9. hb_gt_def_MouseReadKey()\r\n");fflush(stdout);
> 
> and HB_GTSELF_MOUSEGETPOS() should be checked later and is pending
> 
> Reusing:
>       /* if( iEventMask & INKEY_LDOWN && hb_gt_def_MouseButtonPressed(
> pGT, 0, &iRow, &iCol ) ) */
>       if( iEventMask & INKEY_LDOWN && HB_GTSELF_MOUSEBUTTONPRESSED( pGT,
> 0, &iRow, &iCol ) )
> 
> 
> and
> 
> 
> static BOOL hb_gt_os2_mouse_ButtonPressed( PHB_GT pGT, int iButton, int
> * piRow, int * piCol )
> {
>    HB_SYMBOL_UNUSED( pGT );
>    printf("1. hb_gt_os2_mouse_ButtonPressed()\r\n");fflush(stdout);
>    hb_gt_os2_mouse_ReadMouseState();
>    printf("2. hb_gt_os2_mouse_ButtonPressed()\r\n");fflush(stdout);
> 
> and mttest02.exe results:
> ----------------
> 4. hb_gt_os2_ReadKey()
> 1. hb_gt_def_MouseReadKey()
> 1. hb_gt_os2_mouse_IsPresent()
> 2. hb_gt_os2_mouse_IsPresent()
> 1. hb_gt_os2_mouse_ButtonPressed()
> SYS1808:
> The process has stopped.  The software diagnostic
> code (exception code) is  0001.
> ................
> 
> and using a trick to ignore MouReadEventQue( )
> 
>    printf("1. hb_gt_os2_mouse_ReadMouseState()\r\n");fflush(stdout);
>    if( s_uMouHandle )
>    {
>       USHORT WaitOption = 0;  /* 1 = wait until mouse event exist, 0 =
> don't */
>       MOUEVENTINFO MouEvent;
>       printf("2. hb_gt_os2_mouse_ReadMouseState()\r\n");fflush(stdout);
> /*
>       if( MouReadEventQue( &MouEvent, &WaitOption, s_uMouHandle ) ==
> NO_ERROR )
>       {
> */
>       if( s_ButtonState[ 1 ].fDown )
>       {
> 
> and mttest02.exe results:
> ----------------
> 1. hb_gt_def_MouseReadKey()
> 1. hb_gt_os2_mouse_IsPresent()
> 2. hb_gt_os2_mouse_IsPresent()
> 1. hb_gt_os2_mouse_ButtonPressed()
> 1. hb_gt_os2_mouse_ReadMouseState()
> 2. hb_gt_os2_mouse_ReadMouseState()
> 3. hb_gt_os2_mouse_ReadMouseState()
> 4. hb_gt_os2_mouse_ReadMouseState()
> 2. hb_gt_os2_mouse_ButtonPressed()
> 8. hb_gt_def_MouseReadKey()
> SYS1808:
> The process has stopped.  The software diagnostic
> code (exception code) is  0001.
> ...............
> 
> As we see it fail with MouReadEventQue() and dows not fail without it
> 
> This lead us to the pending:
> 
>          printf("8. hb_gt_def_MouseReadKey()\r\n");fflush(stdout);
>          HB_GTSELF_MOUSEGETPOS( pGT, &iRow, &iCol );
> 
> and using
> 
>          printf("8. hb_gt_def_MouseReadKey()\r\n");fflush(stdout);
> /*         HB_GTSELF_MOUSEGETPOS( pGT, &iRow, &iCol ); */
>          printf("9. hb_gt_def_MouseReadKey()\r\n");fflush(stdout);
> 
> does not fail
> So fail happen within
>          HB_GTSELF_MOUSEGETPOS( pGT, &iRow, &iCol );
> 
> and using:
> 
>    printf("1. hb_gt_os2_mouse_GetPos()\r\n");fflush(stdout);
>    if( s_uMouHandle )
>    {
>       PTRLOC pos;
>       printf("2. hb_gt_os2_mouse_GetPos()\r\n");fflush(stdout);
>       MouGetPtrPos( &pos, s_uMouHandle );
>       *row = ( int ) pos.row;
>       *col = ( int ) pos.col;
>       printf("3. hb_gt_os2_mouse_GetPos()\r\n");fflush(stdout);
>    }
> 
> and mttest02.exe results:
> ----------------
> 4. hb_gt_os2_mouse_ReadMouseState()
> 2. hb_gt_os2_mouse_ButtonPressed()
> 8. hb_gt_def_MouseReadKey()
> SYS1808:
> The process has stopped.  The software diagnostic
> code (exception code) is  0001.
> ................
> 
> As you see in this and other cases, fail within hb_gt_os2_mouse_GetPos()
> but screen/output is not refreshed to show at least
>    printf("1. hb_gt_os2_mouse_GetPos()\r\n");fflush(stdout);
>    printf("2. hb_gt_os2_mouse_GetPos()\r\n");fflush(stdout);
> 
> This behaviour confuse us because last info seem to be fail in the
> calling function, while fail occur in called function which does not
> refressh their own printf( )
> I do not know if this is a normal behaviour for printf( )
> 
> Obviously using
> 
>       printf("2. hb_gt_os2_mouse_GetPos()\r\n");fflush(stdout);
>       /* MouGetPtrPos( &pos, s_uMouHandle ); */
> 
> everything work fine
> 
> 
> As summary there are problems in "reading devices" except for thread 1
> 
> Now we have catched at least three points which cause fails:
>   KbdCharIn( )
>   MouReadEventQue( )
>   MouGetPtrPos( )
> 
> and they are NOT Harbour functions/procedures
> 
> Except for calling, KbdCharIn reference exist only in:
> 
> --------------------
>  * $Id: gtkeycod.c 8193 2007-12-22 10:28:28Z druzus $
>  */
> 
> /*
>  * Harbour Project source code:
>  *    hb_gt_dos_keyCodeTranslate()
>  *          function used by DOS, WIN and OS2 ports of few GTs which use
>  *          getkey()/getch()/_read_kbd()/KbdCharIn() or similar function
>  *          for keyboard input
>  *    based on hb_gt_ReadKey() from GTDOS code by:
>  *          Copyright 1999 David G. Holm <[EMAIL PROTECTED]>
> --------------------
> 
> 
> so KbdCharIn( ), MouReadEventQue( ), MouGetPtrPos( ) should belong to C
> compiler or OS/2
> 
> 
> \watcom\h\os2\bsesub.h show for KbdCharIn:
> 
> /*
>  *  bsesub.h    OS/2 Base subsystems include file for 32-bit development.
> 
> #define KbdCharIn        KBD16CHARIN
> #define KR_KBDCHARIN       0x0001
> USHORT APIENTRY16 KbdCharIn(PKBDKEYINFO,USHORT,HKBD);
> 
> 
> and for MouReadEventQue
> 
> #define MouReadEventQue    MOU16READEVENTQUE
> #define MR_MOUREADEVENTQUE  0x00000010
> USHORT APIENTRY16 MouReadEventQue(PMOUEVENTINFO,PUSHORT,HMOU);
> 
> 
> and for MouGetPtrPos
> 
> #define MouGetPtrPos       MOU16GETPTRPOS
> #define MR_MOUGETPTRPOS     0x00020000
> USHORT APIENTRY16 MouGetPtrPos(PPTRLOC,HMOU);
> 
> 
> KBD16CHARIN exist only in:
> #define Kbd16CharIn      KBD16CHARIN
> #define KbdCharIn        KBD16CHARIN
> 
>  \watcom\lib386\os2\clib3r.lib
>  \watcom\lib386\os2\clib3s.lib
>  \watcom\lib386\os2\os2386.lib
> 
> 
> and in \watcom\h\os21x\bsesub.h show for KbdCharIn:
> 
> /*
>  *  bsesub.h    OS/2 Base subsystems include file for 16-bit development.
> 
> #define KR_KBDCHARIN       0x00000001
> USHORT APIENTRY KbdCharIn(PKBDKEYINFO CharData, USHORT IOWait, HKBD
> KbdHandle);
> 
> I suppose that os21x is for OS/2 1.x
> 
> 
> and for gcc335 we have
> 
> \usr\include\os2emx.h
> 
> /* os2emx.h,v 1.19 2004/09/14 22:27:35 bird Exp */
> 
> #define KR_KBDCHARIN            0x00000001
> USHORT APIENTRY KbdCharIn (PKBDKEYINFO pkbci, USHORT fWait, HKBD hkbd);
> 
> #define MR_MOUREADEVENTQUE        0x00000010
> USHORT APIENTRY MouReadEventQue (PMOUEVENTINFO pmouevEvent, PUSHORT
> pfWait, HMOU hmou);
> 
> #define MR_MOUGETPTRPOS            0x00020000
> USHORT APIENTRY MouGetPtrPos (PPTRLOC pmouLoc, HMOU hmou);
> 
> 
> I do not know which differences exist between APIENTRY16 (OW) and
> APIENTRY (OW os21x, gcc335) but they show differences between C
> compilers where at last may reside problem with threads except thread 1
> 
> 
> As you see, I was changing C code myself  :-)
> 
> David Macias
> 
> _______________________________________________
> Harbour mailing list
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour
> 

-- 
 __________
|  |  | |__| Maurilio Longo
|_|_|_|____| farmaconsult s.r.l.


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

Reply via email to