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=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=urpov5bLUXDxlUIXz1mJ3vcixt7g+UksSMnPhC0dACw=; b=l2zLf3GS+hY6A1tiiopWKPvTwGfAWJNHWK23nLDFfUytQbzgOLB/PJrXJHSQtcLJ1I F/jQf7GW9YrW3Hb/XcsSdXCpGZtZl0j0dEPBMcLFyMAQMVALN+s/nFxuFWz4h0TwXVIT 2J5viMndOxbZ/YFUP9XZWgpaQwuBgUJ2Nc3NWplvrnjNlbFV1SrVvBfyYqopANQNdspH o8s70eurL/0SrdKSGzJHqsIVQJkxI7DJXbrMWfBl+KSFKO+hOltx05Yq5pmY188lWhaK VcR/r5p5wh5bY9khuVzxbkRleVRO38F9AT6vY6iQpDH8jIYi8xsbrAEOIQGOj7gTiRfU /CSA== X-Received: by 10.180.107.195 with SMTP id he3mr10327921wib.35.1441921588348; Thu, 10 Sep 2015 14:46:28 -0700 (PDT) Date: Thu, 10 Sep 2015 23:46:26 +0200 From: "Nicklas Karlsson (nicklas DOT karlsson17 AT gmail DOT com) [via geda-user AT delorie DOT com]" To: geda-user AT delorie DOT com Subject: Re: [geda-user] Notice to developers: layers have now a type. Message-Id: <20150910234626.6b47dbc26c5ebd5d69eebab3@gmail.com> In-Reply-To: <55F1F75F.8010809@jump-ing.de> References: <55F1F75F DOT 8010809 AT jump-ing DOT de> X-Mailer: Sylpheed 3.5.0beta1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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, 10 Sep 2015 23:34:23 +0200 "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. > > - - - > > 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. > Really great !!