Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #9047 > unrolled thread

Strange issue with Item API

Started byMartin <Martin@spam.spam>
First post2016-02-26 10:24 +0000
Last post2016-03-21 10:35 +0000
Articles 4 — 2 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Strange issue with Item API Martin <Martin@spam.spam> - 2016-02-26 10:24 +0000
    Re: Strange issue with Item API "Wolfgang Riedmann" <wriedmann@gmail.com> - 2016-02-26 11:39 +0100
      Re: Strange issue with Item API Martin <Martin@spam.spam> - 2016-02-29 10:13 +0000
        Re: Strange issue with Item API Martin <Martin@spam.spam> - 2016-03-21 10:35 +0000

#9047 — Strange issue with Item API

FromMartin <Martin@spam.spam>
Date2016-02-26 10:24 +0000
SubjectStrange issue with Item API
Message-ID<nap8ua$m2f$1@dont-email.me>
This is some code from our routine to read a string from a 2D array. And 
we are getting a very stange issue


If the string contains a ; everything goes mad

The text on screen or report in C is blank, but hard reading the string 
letters gices text from a different array and element.

This is totally wierd, the code has been like this since we started in 
Windows and then that code was migrated from the Clipper ITEM API

Does anyone have any ideas why we are getting strange behavior when 
reading an array in C when there is a ;?

Thanks

Martin



        ITEM subarr;
        ITEM elem;
        LPSTR  str2;
        UINT Type1, Type2;


        // Get the sub array
        subarr = ItemArrayGet(array, (UINT) row );
        G3itemRegister(&subarr);

        // Get the element
        elem = ItemArrayGet(&subarr, (UINT) element );
        G3itemRegister(&elem);

        // Get the contents of element
        Type1 = ItemType(&elem);
        str2 = ItemGetC( &elem );

        //wcscpy( (wchar_t *) str, (wchar_t *) str2 );
        strcpy(str, (char *)str2);

        // Release string
        ItemFreeC( (LPBYTE) str2 );

        // Free sub array
        G3itemRelease( &elem );

        // Free main array
        G3itemRelease( &subarr );

[toc] | [next] | [standalone]


#9048

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2016-02-26 11:39 +0100
Message-ID<djaobmFefbcU1@mid.individual.net>
In reply to#9047
Hi Martin,

do you lock the GC when calling the C code, or do you are protecting
your array in VO, maybe with one of the OldSpace... functions?

Personally, I don't knew that the item API was working in VO, maybe you
should try to rewrite the code to use the normal C interface.

Since Clipper was a 16 bit system, and VO is a 32 bit system, this
could be another source of problems - I don't know if the Item API was
adjusted when porting from VO 1.0 (16 Bit) to VO 2.x (32 Bit).

Wolfgang



Martin wrote:

> This is some code from our routine to read a string from a 2D array.
> And we are getting a very stange issue
> 
> 
> If the string contains a ; everything goes mad
> 
> The text on screen or report in C is blank, but hard reading the
> string letters gices text from a different array and element.
> 
> This is totally wierd, the code has been like this since we started
> in Windows and then that code was migrated from the Clipper ITEM API
> 
> Does anyone have any ideas why we are getting strange behavior when
> reading an array in C when there is a ;?
> 
> Thanks
> 
> Martin
> 
> 
> 
>        ITEM subarr;
>        ITEM elem;
>        LPSTR  str2;
>        UINT Type1, Type2;
> 
> 
>        // Get the sub array
>        subarr = ItemArrayGet(array, (UINT) row );
>        G3itemRegister(&subarr);
> 
>        // Get the element
>        elem = ItemArrayGet(&subarr, (UINT) element );
>        G3itemRegister(&elem);
> 
>        // Get the contents of element
>        Type1 = ItemType(&elem);
>        str2 = ItemGetC( &elem );
> 
>        //wcscpy( (wchar_t *) str, (wchar_t *) str2 );
>        strcpy(str, (char *)str2);
> 
>        // Release string
>        ItemFreeC( (LPBYTE) str2 );
> 
>        // Free sub array
>        G3itemRelease( &elem );
> 
>        // Free main array
>        G3itemRelease( &subarr );



-- 

[toc] | [prev] | [next] | [standalone]


#9058

FromMartin <Martin@spam.spam>
Date2016-02-29 10:13 +0000
Message-ID<nb15eb$dja$1@dont-email.me>
In reply to#9048
We have been using the Item API for about 10 years with VO.

And it is only semi colons which mess up.

Found it was getting the data from the previous read string from VO 
array call.

That is our only advance since posting.

On 26/02/2016 10:39, Wolfgang Riedmann wrote:
> Hi Martin,
>
> do you lock the GC when calling the C code, or do you are protecting
> your array in VO, maybe with one of the OldSpace... functions?
>
> Personally, I don't knew that the item API was working in VO, maybe you
> should try to rewrite the code to use the normal C interface.
>
> Since Clipper was a 16 bit system, and VO is a 32 bit system, this
> could be another source of problems - I don't know if the Item API was
> adjusted when porting from VO 1.0 (16 Bit) to VO 2.x (32 Bit).
>
> Wolfgang
>
>
>
> Martin wrote:
>
>> This is some code from our routine to read a string from a 2D array.
>> And we are getting a very stange issue
>>
>>
>> If the string contains a ; everything goes mad
>>
>> The text on screen or report in C is blank, but hard reading the
>> string letters gices text from a different array and element.
>>
>> This is totally wierd, the code has been like this since we started
>> in Windows and then that code was migrated from the Clipper ITEM API
>>
>> Does anyone have any ideas why we are getting strange behavior when
>> reading an array in C when there is a ;?
>>
>> Thanks
>>
>> Martin
>>
>>
>>
>>         ITEM subarr;
>>         ITEM elem;
>>         LPSTR  str2;
>>         UINT Type1, Type2;
>>
>>
>>         // Get the sub array
>>         subarr = ItemArrayGet(array, (UINT) row );
>>         G3itemRegister(&subarr);
>>
>>         // Get the element
>>         elem = ItemArrayGet(&subarr, (UINT) element );
>>         G3itemRegister(&elem);
>>
>>         // Get the contents of element
>>         Type1 = ItemType(&elem);
>>         str2 = ItemGetC( &elem );
>>
>>         //wcscpy( (wchar_t *) str, (wchar_t *) str2 );
>>         strcpy(str, (char *)str2);
>>
>>         // Release string
>>         ItemFreeC( (LPBYTE) str2 );
>>
>>         // Free sub array
>>         G3itemRelease( &elem );
>>
>>         // Free main array
>>         G3itemRelease( &subarr );
>
>
>

[toc] | [prev] | [next] | [standalone]


#9177

FromMartin <Martin@spam.spam>
Date2016-03-21 10:35 +0000
Message-ID<ncoij8$4h8$1@dont-email.me>
In reply to#9058
My fix will be

cRef := StrTran(cRef,';',',')

On 29/02/2016 10:13, Martin wrote:
> We have been using the Item API for about 10 years with VO.
>
> And it is only semi colons which mess up.
>
> Found it was getting the data from the previous read string from VO
> array call.
>
> That is our only advance since posting.
>
> On 26/02/2016 10:39, Wolfgang Riedmann wrote:
>> Hi Martin,
>>
>> do you lock the GC when calling the C code, or do you are protecting
>> your array in VO, maybe with one of the OldSpace... functions?
>>
>> Personally, I don't knew that the item API was working in VO, maybe you
>> should try to rewrite the code to use the normal C interface.
>>
>> Since Clipper was a 16 bit system, and VO is a 32 bit system, this
>> could be another source of problems - I don't know if the Item API was
>> adjusted when porting from VO 1.0 (16 Bit) to VO 2.x (32 Bit).
>>
>> Wolfgang
>>
>>
>>
>> Martin wrote:
>>
>>> This is some code from our routine to read a string from a 2D array.
>>> And we are getting a very stange issue
>>>
>>>
>>> If the string contains a ; everything goes mad
>>>
>>> The text on screen or report in C is blank, but hard reading the
>>> string letters gices text from a different array and element.
>>>
>>> This is totally wierd, the code has been like this since we started
>>> in Windows and then that code was migrated from the Clipper ITEM API
>>>
>>> Does anyone have any ideas why we are getting strange behavior when
>>> reading an array in C when there is a ;?
>>>
>>> Thanks
>>>
>>> Martin
>>>
>>>
>>>
>>>         ITEM subarr;
>>>         ITEM elem;
>>>         LPSTR  str2;
>>>         UINT Type1, Type2;
>>>
>>>
>>>         // Get the sub array
>>>         subarr = ItemArrayGet(array, (UINT) row );
>>>         G3itemRegister(&subarr);
>>>
>>>         // Get the element
>>>         elem = ItemArrayGet(&subarr, (UINT) element );
>>>         G3itemRegister(&elem);
>>>
>>>         // Get the contents of element
>>>         Type1 = ItemType(&elem);
>>>         str2 = ItemGetC( &elem );
>>>
>>>         //wcscpy( (wchar_t *) str, (wchar_t *) str2 );
>>>         strcpy(str, (char *)str2);
>>>
>>>         // Release string
>>>         ItemFreeC( (LPBYTE) str2 );
>>>
>>>         // Free sub array
>>>         G3itemRelease( &elem );
>>>
>>>         // Free main array
>>>         G3itemRelease( &subarr );
>>
>>
>>
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web