← Back to team overview

kicad-developers team mailing list archive

Re: Question about kifaced globals

 

On 04/20/2014 04:24 AM, Dick Hollenbeck wrote:
> On 04/20/2014 04:09 AM, Lorenzo Marcantonio wrote:
>> It a misconception of mine or globals can't be "split"?
>>
>> I.e. if for some reason you instance two pcbnew in the same process all
>> the globals (and class/function static) become shared?
>>
>> Could this give problem? Is there some data/BSS trick to avoid it?
>>
> 
> 
> Yes globals are global.  Most of them are now a problem, now that I have my mind set on
> supporting multiple instances of the same KIWAY_PLAYER types in the same process.  I have
> spoken to Wayne about this and it is on its way into the roadmap as a soon TODO item.
> 
> In some cases we actually need globals, so some percentage of them can stay global.  The
> others will have to made instance specific.  I recommended that those be put into a
> containing struct, and then that struct be held in the PROJECT or held in the wxFrame.
> 
> Those two objects, the PROJECT and the wxFrame are instance specific.  The wxFrame is also
> purpose specific, whereas the PROJECT is cross purpose.  This provides an opportunity to
> use both of these boxes, and sort the problem globals into the proper box.


Add to that list, the data tree which you are editing, such as a BOARD for example.  This
offers yet another box to put things in.  So to summarize the opportunity to "sort":

a) truly global.
b) project specific, but cross purpose
c) project and frame specific
d) project specific and file specific, things that should be in a datafile.


This requires clear thinking, but it is an opportunity to bring much greater organization
to the code.  Each global has to be viewed separately and sorted separately.



> 
> Also note that we are talking about a handful of wxFrames, so you have a handful of boxes
> available, not just two.  You have one PROJECT and multiple wxFrames.
> 
> This kind of sorting is really not much more than that, sorting followed by search and
> replace.  It should not be made into a mountain of work.
> 
> 
> Dick
> 
> 
> 
> _______________________________________________
> 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
> 



References