www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2016/01/17/16:14:02

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: <CAC4O8c9eSvBVJ0oj17Tv+HFqSU3k3KAF2qjDi8S3B+ayqQx_6w AT mail DOT gmail DOT com>
<201601170055 DOT u0H0to54024329 AT envy DOT delorie DOT com>
<CAC4O8c8piNdZD2R=9BOu5Rw2u584jY4J1wAREZhu7rKu0h8xEg AT mail DOT gmail DOT com>
<569AF06E DOT 1010902 AT prochac DOT sk>
Date: Sun, 17 Jan 2016 12:12:17 -0900
Message-ID: <CAC4O8c8kck08w9NuyhCoJC5pPK__Mt6KKUfZfcMdWM-q02tQ6g@mail.gmail.com>
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]" <geda-user AT delorie DOT com>
To: geda-user AT delorie DOT com
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

--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] <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 <stdio.h>

     #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

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Sat, Jan 16, 2016 at 4:37 PM, Milan Prochac (<a href=3D"mailto:milan=
@prochac.sk">milan AT prochac DOT sk</a>) [via <a href=3D"mailto:geda-user AT delorie=
.com">geda-user AT delorie DOT com</a>] <span dir=3D"ltr">&lt;<a href=3D"mailto:ge=
da-user AT delorie DOT com" target=3D"_blank">geda-user AT delorie DOT com</a>&gt;</span>=
 wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.=
8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-st=
yle:solid;padding-left:1ex"><span class=3D""><br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex">
Well I&#39;d prefer he had one too but I already asked twice he obviously d=
oesn&#39;t want to.=C2=A0 He said he&#39;d send careful patches.=C2=A0 So i=
f he chooses to sync up with bert&#39;s version great but if not bert&#39;s=
 should go away in favor of his for now, its pointless to painfully merge e=
very change he sends when bert&#39;s could much more easily be applied late=
r<br>
<br>
</blockquote>
<br></span>
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.<br></blockquote><div><br><=
/div><div style=3D"">Great this will be best</div><div>=C2=A0</div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-wid=
th:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-l=
eft:1ex">
I offered the modular file format as proof of concept. But the pressure to =
push it to production quality is higher than expected.<br></blockquote><div=
><br></div><div style=3D"">It already seems pretty darn good :)</div><div>=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0=
.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-s=
tyle:solid;padding-left:1ex">
I have already prepared some changes based on your recommendations and idea=
s, some more will be finished in day or two.<br></blockquote><div><br></div=
><div style=3D"">I ran into a couple more small issues.=C2=A0 You&#39;re pr=
obably already aware but here they are:</div><div style=3D""><br></div><div=
 style=3D"">* 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&#39;t actually saved.=
=C2=A0 I&#39;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&#39;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&#39; t want to fix it both places as would just make =
merge pain later</div><div style=3D""><br></div><div style=3D"">* It looks =
like SavePCB() and SavePCB2() are dead code now so should be removed.=C2=A0=
 I like to put &#39;// FIXME: I think I&#39;m dead&#39; by stuff like this =
but maybe you just remember</div><div style=3D""><br></div><div style=3D"">=
* There&#39;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.</div><div style=3D""><br></div><div style=3D""><div=
><div>=C2=A0 =C2=A0 =C2=A0#include &lt;stdio.h&gt;</div><div>=C2=A0 =C2=A0 =
=C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0#define FORMAT_ID foo</div><div>=C2=A0=
 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0// Stringify the argument.=C2=
=A0 Note that the argument isn&#39;t expanded.</div><div>=C2=A0 =C2=A0 =C2=
=A0#define STRINGIFY(arg) #arg</div><div>=C2=A0 =C2=A0 =C2=A0// First expan=
d arg then STRINGIFY() it.</div><div>=C2=A0 =C2=A0 =C2=A0#define EXPAND_AND=
_STRINGIFY(arg) STRINGIFY (arg)</div><div>=C2=A0 =C2=A0 =C2=A0// Conctenate=
 arg1 and arg2.=C2=A0 Note that the arguments aren&#39;t expanded.</div><di=
v>=C2=A0 =C2=A0 =C2=A0#define CONCAT(arg1, arg2) arg1 ## arg2</div><div>=C2=
=A0 =C2=A0 =C2=A0// First expand arg1 and arg2, then concatenate the result=
s.</div><div>=C2=A0 =C2=A0 =C2=A0#define EXPAND_AND_CONCAT(arg1, arg2) CONC=
AT (arg1, arg2)</div><div>=C2=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 =C2=
=A0#define FORMAT_ID_STRING EXPAND_AND_STRINGIFY (FORMAT_ID)</div><div>=C2=
=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0#define FORMAT_FUNC(arg) EX=
PAND_AND_CONCAT (arg, FORMAT_ID)</div><div>=C2=A0 =C2=A0 =C2=A0</div><div>=
=C2=A0 =C2=A0 =C2=A0int</div><div>=C2=A0 =C2=A0 =C2=A0FORMAT_FUNC (parse) (=
char *filename)</div><div>=C2=A0 =C2=A0 =C2=A0{</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0printf (</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot=
;I&#39;m a &quot; FORMAT_ID_STRING &quot; parser parsing %s in %s!\n&quot;,=
</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0filename,</div><div>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__func__</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0);</div><div>=C2=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0return 0;</div><div>=C2=A0 =C2=A0 =C2=A0}</div><div>=C2=
=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0int</div><div>=C2=A0 =C2=A0=
 =C2=A0main (void)</div><div>=C2=A0 =C2=A0 =C2=A0{</div><div>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0(FORMAT_FUNC (parse)) (&quot;file.foo&quot;);</div><div>=C2=A0=
 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;</div><div>=C2=
=A0 =C2=A0 =C2=A0}</div></div><div><br></div><div style=3D"">It&#39;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.</div><div style=3D""=
><br></div><div style=3D"">Britton</div></div></div></div></div>

--047d7b5d26c25ff68e05298e173d--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019