X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Ps8cuCYd/RxRIJBhWvmLLYG7zQgAODzt9hBlXFM9yAM=; b=muqLNs+WyPh08HXWzQnKTvNhhs6Hs/dNAlKzdJspJhpIX9//WgQUHKysSVK7TqR0j9 Ztx4k63vrb70q2XP/tgbagk1zgeCmkny4+kmpbKeZ3OBL3jCJldA72MpclIQthqJxIFi +tuX6WOaonFiMPqITPFftaytjw0lwnVkLXDKiIPt4gUdp70tGRmtL6nfUBIYMWkkqRcR CWI40y3GPm9neVL9n2Dx5CKmhUTCLOFzmwbFp61BDPGsonxsJbyfnBc/NIi61gKAJfbS FBYZ6rmZucGIyrGZZD/CYmVNrq+4AIZYXWCG1N5SOnADQg7CEjbN1d0xQJ0vbw8Dkn/x ZYQA== MIME-Version: 1.0 X-Received: by 10.152.26.98 with SMTP id k2mr4704128lag.41.1441922004199; Thu, 10 Sep 2015 14:53:24 -0700 (PDT) In-Reply-To: <55F1F75F.8010809@jump-ing.de> References: <55F1F75F DOT 8010809 AT jump-ing DOT de> Date: Thu, 10 Sep 2015 21:53:24 +0000 Message-ID: Subject: Re: [geda-user] Notice to developers: layers have now a type. From: "Evan Foss (evanfoss AT gmail DOT com) [via geda-user AT delorie DOT com]" To: geda-user AT delorie DOT com Content-Type: text/plain; charset=UTF-8 Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, Sep 10, 2015 at 9:34 PM, Markus Hitter (mah AT jump-ing DOT de) [via geda-user AT delorie DOT com] wrote: > Dear developers, > > unless there appears evidence it doesn't work as expected, I'll forward > branch LP1493557 to master tomorrow. It's the essence of a patch made by > DJ Delorie in 2007 and some of my work for refining. Every single commit > passes the regression test. > > The new code will give layers a type. These types exist (see hid.h and > strflags.c): > > "copper", /* LT_COPPER */ > "silk", /* LT_SILK */ > "mask", /* LT_MASK */ > "pdrill", /* LT_PDRILL */ > "udrill", /* LT_UDRILL */ > "paste", /* LT_PASTE */ > "invisible", /* LT_INVISIBLE */ > "fab", /* LT_FAB */ > "assy", /* LT_ASSY */ > "outline", /* LT_OUTLINE */ > "route", /* LT_ROUTE */ > "notes", /* LT_NOTES */ > "keepout", /* LT_KEEPOUT */ > "no_type" /* LT_NUM_LAYERTYPES */ > > To the left the name as it appears in the saved file, to the right the > flag to test for in code. Does this mean that you can now draw voids in the mask layer? > - - - > > Examples: > > To test wether a specific layer is a copper (conductive) layer, do it > like this: > > if (PCB->Data->Layer[index].Type == LT_COPPER) > ... > > To iterate through all layers of a specific type, there's now a > comfortable macro. For example to loop over all paste layers: > > LAYER_TYPE_LOOP (PCB->Data, max_copper_layer + SILK_LAYER, LT_PASTE) > do_something_with (layer); > layer_number_is (n); > END_LOOP; > > > N.B. the term 'max_copper_layer + SILK_LAYER' is simply the number of > defined layers, so you get all defined layers. For details see src/const.h. > > - - - > > How does this meet existing design files? > > Currently the above techniques aren't in use, yet, all code still uses > various voodoo heuristics in many places to guess the type of a layer as > it did the last 20 years. So, no immediate change in behaviour expected. > > When loading older files, some such voodoo heuristics > ("guess_layertype()") is now used right at load time. So all future code > can rely on an existing layertype from now on. Patches replacing old > heuristics by simple tests or loops, like shown above, are very welcome. > > At save time, layer types are saved, so this guessing is done only once. > Former layer definition: > > Layer(1 "component") > > From now on > > Layer(1 "component" "copper") > > Easy to edit, it's Layer( ) > > Older versions of pcb can load files saved with newer version, they > simply ignore the type field. > > > As said, code is currently on the LP1493557 branch in the official Git repo: > http://git.geda-project.org/pcb/log/?h=LP1493557 > > > Happy hacking, > Markus > > -- > - - - - - - - - - - - - - - - - - - - > Dipl. Ing. (FH) Markus Hitter > http://www.jump-ing.de/ -- Home http://evanfoss.googlepages.com/ Work http://forge.abcd.harvard.edu/gf/project/epl_engineering/wiki/