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=wmM2cVx9cAdCzm7EIcquavtbb0Yq9rpFd68aiA17weI=; b=dFMLKtSoqQoeTgSWHyj0NH9f5LwKqR3zujs/viofhMhQ6417NkFLI33LGPVgUxyKq9 rHbisdpfepcYSlNiwww3nigVNfdI/0hhfssrYoUv+5TXUTudVgFAyaToSMzprQlnrsdx qSIIcNuDe9hCr7b2DRBOIKn1+oSPOKfyT5uMfSJjtc3MIf3bi/iq3ofrSS6xMf9MiHJG eD5WoC19/iX1Qm1Nbv5/ehDc1kyMjMulKh7LwkOI6Cg9E+kScZ2L2FlszchibicersX/ VukpK97r5YBf2q6ImLreQtDtDu8faAXX7P1USNPpnqYs1FC5GKBeYPrw8p+ZD6h1Ew6M XTyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=wmM2cVx9cAdCzm7EIcquavtbb0Yq9rpFd68aiA17weI=; b=LUgTpwBc7J89zzwpvsyUkuQUEyjPU5cPcgBzuljmeLQ0Ut9MZXciXqLHHHr5gDGUyK Q1MJta5SjvaDIPTnT9hxyLIetPnjcDvnl84LPzJ9NaeASA6BP2D54iNMB7sBMCD6/IQb 32gyVqqlm9c8qOuwyFC0agHRbNJtvsOBW0mi5AC+5T4enImn5Y0+l3e3enKc45Xklhnb Mxw6OKZqOka0L8S37vA1xU43JQKMzy2ZERU2UIXble5oBP1s9k4c/ZWjx6ju0i3+y0rM J7RU18dThgT8Qn8eP/8hExkAd4cgRQthM8iEDzg+RK1/SNJ3Npzyp2Xmsd/VJMXm3LZw Pccw== X-Gm-Message-State: AG10YORVnjyUEJi8qTnLCDJ1CMG6pMF9/j6U6f8Rku6ghxitvXZMekgs0WDjQIAG37HsMWMCcXFany6NU75H6w== MIME-Version: 1.0 X-Received: by 10.194.19.164 with SMTP id g4mr11774wje.120.1453065137810; Sun, 17 Jan 2016 13:12:17 -0800 (PST) In-Reply-To: <569AF06E.1010902@prochac.sk> References: <201601170055 DOT u0H0to54024329 AT envy DOT delorie DOT com> <569AF06E DOT 1010902 AT prochac DOT sk> Date: Sun, 17 Jan 2016 12:12:17 -0900 Message-ID: Subject: Re: [geda-user] can we agree on a common start point for file format plugin stuff please From: "Britton Kerin (britton DOT kerin AT gmail DOT com) [via geda-user AT delorie DOT com]" To: geda-user AT delorie DOT com Content-Type: multipart/alternative; boundary=047d7b5d26c25ff68e05298e173d 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 --047d7b5d26c25ff68e05298e173d Content-Type: text/plain; charset=UTF-8 On Sat, Jan 16, 2016 at 4:37 PM, Milan Prochac (milan AT prochac DOT sk) [via geda-user AT delorie DOT com] wrote: > > Well I'd prefer he had one too but I already asked twice he obviously >> doesn't want to. He said he'd send careful patches. So if he chooses to >> sync up with bert's version great but if not bert's should go away in favor >> of his for now, its pointless to painfully merge every change he sends when >> bert's could much more easily be applied later >> >> > It seems that it will be easier for everybody to move all work to my > private branch. I asked for git account already. > Great this will be best > I offered the modular file format as proof of concept. But the pressure to > push it to production quality is higher than expected. > It already seems pretty darn good :) > I have already prepared some changes based on your recommendations and > ideas, some more will be finished in day or two. > I ran into a couple more small issues. You're probably already aware but here they are: * The untrue (failure) result from SavePCBWithFormat() seems totally ignored, it should really get an error popup or at the very least a log message since this is the case where your work isn't actually saved. I'm not sure if it could be handled at the SavePCBWithFormat() call points or if it would need to be further up. This isn't a problem with your branch, master has it too. But it might be easier to fix in your branch since it looks like you factored SavePCBWithFormat() into backup. We don' t want to fix it both places as would just make merge pain later * It looks like SavePCB() and SavePCB2() are dead code now so should be removed. I like to put '// FIXME: I think I'm dead' by stuff like this but maybe you just remember * There's some scope to reduce the number of points that need to be edited in fftemplate.c. For example with the below only the first define value needs to change. #include #define FORMAT_ID foo // Stringify the argument. Note that the argument isn't expanded. #define STRINGIFY(arg) #arg // First expand arg then STRINGIFY() it. #define EXPAND_AND_STRINGIFY(arg) STRINGIFY (arg) // Conctenate arg1 and arg2. Note that the arguments aren't expanded. #define CONCAT(arg1, arg2) arg1 ## arg2 // First expand arg1 and arg2, then concatenate the results. #define EXPAND_AND_CONCAT(arg1, arg2) CONCAT (arg1, arg2) #define FORMAT_ID_STRING EXPAND_AND_STRINGIFY (FORMAT_ID) #define FORMAT_FUNC(arg) EXPAND_AND_CONCAT (arg, FORMAT_ID) int FORMAT_FUNC (parse) (char *filename) { printf ( "I'm a " FORMAT_ID_STRING " parser parsing %s in %s!\n", filename, __func__ ); return 0; } int main (void) { (FORMAT_FUNC (parse)) ("file.foo"); return 0; } It's also a good idea to use use static functions for Parse Save etc. provided everything external goes through the pointers in HID_Format, in which case the function-name generating macro invocations are optional. Britton --047d7b5d26c25ff68e05298e173d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Sat, Jan 16, 2016 at 4:37 PM, Milan Prochac (milan AT prochac DOT sk) [via geda-user AT delorie DOT com] <geda-user AT delorie DOT com>= wrote:

Well I'd prefer he had one too but I already asked twice he obviously d= oesn't want to.=C2=A0 He said he'd send careful patches.=C2=A0 So i= f he chooses to sync up with bert's version great but if not bert's= should go away in favor of his for now, its pointless to painfully merge e= very change he sends when bert's could much more easily be applied late= r


It seems that it will be easier for everybody to move=C2=A0 all work to my = private branch. I asked for git account already.

<= /div>
Great this will be best
=C2=A0
I offered the modular file format as proof of concept. But the pressure to = push it to production quality is higher than expected.

It already seems pretty darn good :)
= =C2=A0
I have already prepared some changes based on your recommendations and idea= s, some more will be finished in day or two.

I ran into a couple more small issues.=C2=A0 You're pr= obably already aware but here they are:

* The untrue (failure) result from SavePCBWithFormat() seems to= tally ignored, it should really get an error popup or at the very least a l= og message since this is the case where your work isn't actually saved.= =C2=A0 I'm not sure if it could be handled at the SavePCBWithFormat() c= all points or if it would need to be further up.=C2=A0 This isn't a pro= blem with your branch, master has it too.=C2=A0 But it might be easier to f= ix in your branch since it looks like you factored SavePCBWithFormat() into= backup.=C2=A0 We don' t want to fix it both places as would just make = merge pain later

* It looks = like SavePCB() and SavePCB2() are dead code now so should be removed.=C2=A0= I like to put '// FIXME: I think I'm dead' by stuff like this = but maybe you just remember

= * There's some scope to reduce the number of points that need to be edi= ted in fftemplate.c.=C2=A0 For example with the below only the first define= value needs to change.

=C2=A0 =C2=A0 =C2=A0#include <stdio.h>
=C2=A0 =C2=A0 = =C2=A0
=C2=A0 =C2=A0 =C2=A0#define FORMAT_ID foo
=C2=A0= =C2=A0 =C2=A0
=C2=A0 =C2=A0 =C2=A0// Stringify the argument.=C2= =A0 Note that the argument isn't expanded.
=C2=A0 =C2=A0 =C2= =A0#define STRINGIFY(arg) #arg
=C2=A0 =C2=A0 =C2=A0// First expan= d arg then STRINGIFY() it.
=C2=A0 =C2=A0 =C2=A0#define EXPAND_AND= _STRINGIFY(arg) STRINGIFY (arg)
=C2=A0 =C2=A0 =C2=A0// Conctenate= arg1 and arg2.=C2=A0 Note that the arguments aren't expanded.
=C2=A0 =C2=A0 =C2=A0#define CONCAT(arg1, arg2) arg1 ## arg2
=C2= =A0 =C2=A0 =C2=A0// First expand arg1 and arg2, then concatenate the result= s.
=C2=A0 =C2=A0 =C2=A0#define EXPAND_AND_CONCAT(arg1, arg2) CONC= AT (arg1, arg2)
=C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0 =C2= =A0#define FORMAT_ID_STRING EXPAND_AND_STRINGIFY (FORMAT_ID)
=C2= =A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0 =C2=A0#define FORMAT_FUNC(arg) EX= PAND_AND_CONCAT (arg, FORMAT_ID)
=C2=A0 =C2=A0 =C2=A0
= =C2=A0 =C2=A0 =C2=A0int
=C2=A0 =C2=A0 =C2=A0FORMAT_FUNC (parse) (= char *filename)
=C2=A0 =C2=A0 =C2=A0{
=C2=A0 =C2=A0 =C2= =A0 =C2=A0printf (
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"= ;I'm a " FORMAT_ID_STRING " parser parsing %s in %s!\n",=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0filename,
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__func__
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0);
=C2=A0 =C2=A0 =C2=A0
=C2=A0 = =C2=A0 =C2=A0 =C2=A0return 0;
=C2=A0 =C2=A0 =C2=A0}
=C2= =A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0 =C2=A0int
=C2=A0 =C2=A0= =C2=A0main (void)
=C2=A0 =C2=A0 =C2=A0{
=C2=A0 =C2=A0 = =C2=A0 =C2=A0(FORMAT_FUNC (parse)) ("file.foo");
=C2=A0= =C2=A0 =C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
=C2= =A0 =C2=A0 =C2=A0}

It's also = a good idea to use use static functions for Parse Save etc. provided everyt= hing external goes through the pointers in HID_Format, in which case the fu= nction-name generating macro invocations are optional.

Britton
--047d7b5d26c25ff68e05298e173d--