← Back to team overview

kicad-developers team mailing list archive

Re: Fixing libcommon

 

On 3/22/2017 4:41 AM, Maciej Sumiński wrote:
> On 03/20/2017 02:36 PM, Wayne Stambaugh wrote:
>> On 3/18/2017 10:18 AM, Maciej Suminski wrote:
>>> In order to remove the hardcoded values from WORKSHEET_VIEWITEM, I
>>> started moving code that used to be compiled multiple times to separate
>>> units. This is also a basic way to solve the internal units conversion
>>> problem.
>>>
>>> There are still a few more files that are compiled multiple times. I
>>> plan to fix them as well, but first I want to send the first patches to
>>> see if we all agree on the proposed solution.
>>>
>>> Alternatively, there could be an abstract class to provide conversion
>>> methods. If it is preferred, then we need to decide how to access its
>>> instance (singleton, attach to KiFace, static object?)
>>
>> This would be my preference.  The solution in your patch set has a lot
>> of duplicate code with different per application scalars.  I would think
>> that an abstract class would be a more elegant design.  I OK with
>> pushing your current patches and refactoring the scalar code into an
>> abstract class at a later date.  I don't have a strong preference for
>> singleton versus static.
> 
> Then we could have a look at old Tom's branch [1]. It provides UNITS
> class with derived classes to handle all KiCad applications. Just by
> looking at the code, it seems to completely eliminate #ifdefs in libcommon.
> 
> If you are ok with his changes, I can rebase them and test if they work
> as expected.
> 
> Regards,
> Orson
> 
> 1. https://github.com/twlostow/kicad-dev/tree/libcommon-deifdefied

I took a quick look at this and for the most part it seems OK.  I'm not
terribly thrilled with the global variables used for the internal units
objects.  I would much rather see a singleton or static objects.  I also
didn't see any changes to the page settings dialog which also is
compiled multiple times so you may want to grep the code to make sure
there not any other places that were missed.  Please fix the coding
policy issues as well.

Cheers,

Wayne

> 
>>> Ultimately we can have a real common library for all apps (libkicommon?)
>>> that could be compiled as a shared library. Such approach should reduce
>>> *.kiface files size and linking time.
>>
>> This should be the goal.  My guess is there are lots of
>> inter-dependencies that will make this goal more challenging then you
>> might expect.  I looked at this a long time ago and that was the
>> conclusion that I came to.  Maybe over the years, some of that ugliness
>> has been refactored away.
>>
>> Cheers,
>>
>> Wayne
>>
>>>
>>> Any thoughts?
>>>
>>> Regards,
>>> Orson
>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
> 
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Follow ups

References