discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GDL2: prototypes and EOAttribute.m


From: Matt Rice
Subject: Re: GDL2: prototypes and EOAttribute.m
Date: Tue, 2 May 2017 01:32:33 -0700

Unfortunately Mark, it has been a decade or so since my last
involvement with the project,
And I don't have an environment with gnustep on it to test, and no
longer really recall the details.

Hopefully someone with knowledge what may have changed with regards to
KVC can have a look,
if not I will try and get everything set up.


On Tue, May 2, 2017 at 12:10 AM, Mark Clements <address@hidden> wrote:
> To add to this, I have now attached the tests.log file.
>
> There is one failed test under
> gdl2/EOKeyValueCoding/EOKeyValueCoding00.m. The test is:
>
>   START_TEST(YES);
>   [obj takeValue: @"obj_val" forKey: @"obj_iv"];
>   [obj takeValue: @"_obj_val" forKey: @"_obj_iv"];
>   [obj takeValue: @"_obj_other_val" forKey: @"other_obj_iv"];
>
>   result = [[obj valueForKey: @"obj_iv"] isEqual: @"obj_val"];
>   result = result
>     && [[obj valueForKey: @"_obj_iv"] isEqual: @"_obj_val"];
>   result = result
>     && [[obj valueForKey: @"other_obj_iv"] isEqual: @"_obj_other_val"];
>   result = result
>     && [[obj valueForKey: @"_other_obj_iv"] isEqual: @"_obj_other_val"];
>   END_TEST(result,
>        "-[NSObject(EOKeyValueCoding) takeValue:forKey:/valueForKey:](iv)");
>
> The first result fails because [obj valueForKey: @"obj_iv"] is equal to
> @"_obj_val" rather than @"obj_val". What behaviour is expected here?
>
> Kindly, Mark.
>
> On 05/02/2017 07:50 AM, Mark Clements wrote:
>> I have now attached a diff file for these changes.
>>
>> Kindly, Mark.
>>
>> On 05/01/2017 11:25 PM, Mark Clements wrote:
>>> I have had a first attempt at getting the testsuite working with GDL2.
>>>
>>> It seems to have been a while since the GDL2 testsuite was updated (see
>>> patch below). Suggested changes include:
>>>  + Bug fixes on labelling
>>>  + Change -cString to -UTF8String
>>>  + Change sel_eq to sel_isEqual
>>>  + Change #include "../ObjectTesting.h" to #include "ObjectTesting.h"
>>>  + Change ADDITIONAL_NATIVE_LIBS+=EOControl EOAccess  to
>>> ADDITIONAL_NATIVE_LIBS+=EOAccess EOControl (?)
>>>  + Comment out TEST_EXCEPTION: is this still defined?
>>>
>>> This gave me 1031 passed tests, 10 failed sets, 9 failed tests and 5
>>> failed files.
>>>
>>> I was not certain whether the failed tests indicate that the Key Value
>>> Coding mechanism is broken. Any guidance on this point would be welcomed.
>>>
>>> Kindly, Mark.
>>>
>>> [snip]
>>>
>>>
>>> On 04/28/2017 01:00 PM, Matt Rice wrote:
>>>> On Fri, Apr 28, 2017 at 2:21 AM, Mark Clements <address@hidden> wrote:
>>>>> I am new to Objective C and GNUstep - and interested in GDL2.
>>>>>
>>>>> Using https://github.com/gnustep/gdl2 and gcc 4.8.4, I have been working 
>>>>> with the Trading example with PostgreSQL and ran into a bug:
>>>>>
>>>>> Examples/Trading/obj/createTradingDB: Uncaught exception 
>>>>> PostgreSQLException, reason: SQL expression 'CREATE TABLE TST_CUSTOMER 
>>>>> (GRPID (null), NAME (null)(30) NOT NULL, PID (null) NOT NULL)' caused 
>>>>> ERROR:  syntax error at or near "("
>>>>> LINE 1: CREATE TABLE TST_CUSTOMER (GRPID (null), NAME (null)(30) NOT...
>>>>>                                          ^
>>>>> In looking for a bug fix, I was - and am - confused by how prototypes are 
>>>>> used in EOAttribute.m. The documentation and comments suggest that the 
>>>>> getters use _prototype, but this is not implemented in code. Moreover, 
>>>>> does -(void)_updateFromPrototype actually update the values in the 
>>>>> EOAttribute class? The following patch seems to work for this example - 
>>>>> but is it correct?
>>>> Hi Mark,
>>>>
>>>> It has been a fairly long time since i've much looked at the GDL2 code 
>>>> base,
>>>> So i am probably not going to be of much help, in the correctness
>>>> however _updateFromPrototype does at least _attempt_ to update the values.
>>>>
>>>> EOAttribute.m:2281 [self takeValuesFromDictionary:notOverridenKV];
>>>>
>>>> This should result in the various -[EOAttribute set*:]  methods being
>>>> called (eventually after routing through the Key Value Coding
>>>> mechanism.
>>>>
>>>> It however wouldn't surprise me if this were broken, GDL2 was somewhat
>>>> reliant on an older version of KVC, and there has been various API
>>>> churn in this regard that came from Apple...
>>>>
>>>>> As a second question: what is a canonical approach for running 
>>>>> createTradingDB without make install? The incantation I have been using 
>>>>> is:
>>>>>
>>>>> TEST_ADAPTOR=PostgreSQL 
>>>>> LD_LIBRARY_PATH=EOAccess/obj:EOControl/obj:Examples/Trading/obj:$LD_LIBRARY_PATH
>>>>>  Examples/Trading/obj/createTradingDB --GNU-Debug=gsdb
>>>>>
>>>>> Kindly, Mark.
>>>> This in particular is a very hairy subject, due to GDL2's reliance on
>>>> bundle loading etc,
>>>> Do you have the GDL2 adaptors installed in the framework in gnusteps
>>>> root somewhere? (Otherwise I would be surprised if this worked due to
>>>> the way adaptors are located),
>>>>
>>>> If so, take care to check if you are using GDL2 libraries from one
>>>> compile, (in the local directory via LD_LIBRARY_PATH), and adaptors
>>>> from another (In the frameworks/ directory)
>>>>
>>>> I would recommend putting the glibc (assuming glibc?) LD_DEBUG="files"
>>>> environment variable, to check and make sure that you are not mixing
>>>> libraries from various compiles
>>>>
>>>> IMO this is quite unfortunate,
>>>>
>>>> There is also this repository here containing the testsuite.
>>>>
>>>> http://svn.gna.org/viewcvs/gnustep/tests/testsuite/trunk/gdl2/
>>>>
>>>> Overall, i'm not sure about the patch (It sounds like this should be
>>>> happening in the takeValue* call discussed above, rather than the
>>>> getter, and that something has gone awry there).
>>>>
>>>> Hope this helps.
>>>>
>>>>
>>>>
>>>>> diff --git a/EOAccess/EOAttribute.m b/EOAccess/EOAttribute.m
>>>>> index df9b36e..58255ea 100644
>>>>> --- a/EOAccess/EOAttribute.m
>>>>> +++ b/EOAccess/EOAttribute.m
>>>>> @@ -511,17 +511,29 @@ static NSArray* staticPrototypeKeys=nil;
>>>>>   */
>>>>>  - (int)scale
>>>>>  {
>>>>> -  return _scale;
>>>>> +  if (_scale>0)
>>>>> +    return _scale;
>>>>> +  else if (_prototype && [_prototype scale])
>>>>> +    return [_prototype scale];
>>>>> +  else return 0;
>>>>>  }
>>>>>
>>>>>  - (unsigned)precision
>>>>>  {
>>>>> -  return _precision;
>>>>> +  if (_precision>0)
>>>>> +    return _precision;
>>>>> +  else if (_prototype && [_prototype precision])
>>>>> +    return [_prototype precision];
>>>>> +  else return 0;
>>>>>  }
>>>>>
>>>>>  - (unsigned)width
>>>>>  {
>>>>> -  return _width;
>>>>> +  if (_width>0)
>>>>> +    return _width;
>>>>> +  else if (_prototype && [_prototype width])
>>>>> +    return [_prototype width];
>>>>> +  else return 0;
>>>>>  }
>>>>>
>>>>>  - (id)parent
>>>>> @@ -636,6 +648,8 @@ static NSArray* staticPrototypeKeys=nil;
>>>>>      return _valueClassName;
>>>>>    else if ([self isFlattened])
>>>>>      return [[_definitionArray realAttribute] valueClassName];
>>>>> +  else if (_prototype && [_prototype valueClassName])
>>>>> +    return [_prototype valueClassName];
>>>>>    else
>>>>>      return nil;
>>>>>  }
>>>>> @@ -656,6 +670,8 @@ static NSArray* staticPrototypeKeys=nil;
>>>>>      return _externalType;
>>>>>    else if ([self isFlattened])
>>>>>      return [[_definitionArray realAttribute] externalType];
>>>>> +  else if (_prototype && [_prototype externalType])
>>>>> +    return [_prototype externalType];
>>>>>    else
>>>>>      return nil;
>>>>>  }
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Discuss-gnustep mailing list
>>>>> address@hidden
>>>>> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]