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=8jo4/+jtN2HpT0e9pWJTppq72XDDXEye2KwbVVjqLw4=; b=H53b6fOc2bhPLNesELhXZglEZank8I8258YOgCzvY8+07HcSXfy64spNC2t6a6nf6I zlF9CtlsIUsu7+9hbkjy3gifTHP5R+K7FvcefQ+QPJQkdPz0YfKdAYN+fHki6fugv84n ssF/pwVtwf0OOpaRipOc0erDBZPve7+RNREbvrVklv7bcfSTb7S5/L6WFncarRwS+WRi GKLMzsC/KTjogS4WSAM5CpvhZCaj93wGSdtIPjCtmrOy+szvluj6tuIdt1TzVI7/DIYY EdjzqzhxhAVaJ60wxolDBTZU3qVSzQOyRddXQgCbgUDTvfewb+VZPWxFX5ZVLimCcdM1 1WaA== 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=8jo4/+jtN2HpT0e9pWJTppq72XDDXEye2KwbVVjqLw4=; b=Rq2DsYM9Barz7mfpMx5OLjlH9G4ECvy/hbpij3pQlibFzVVcqlhc63QUj5xdM9wQFK RLw7paBNMZw9x0CxuFC7U4+iBfaMfo08ahzXDLLQe9Xfh68LOw+8awJVlfPwr6lTvllw IhrbLEYzcB1KO83jpeeNW+QVmLyVM8KakhafmvRyqKhGFZohEwXhM5mzQUuGHoCpMoAg htzqlt0s2ceY39mLZmt05ajpe5pQ38icuULDw42829Il7tWhhxYewrDjYI3OlLRHN4DR DeYeSDqrciznCk4k4y0vnH6xd6FXPMpWya4KPDsqhhpQeqxihwW8NvfjZ7Nm0T7PV0w+ xHBQ== X-Gm-Message-State: ALoCoQnYe+zTkoTmfvW9gOSdzknElVG668fRxlDtq1oZdfgSXXqfN5BF7kgUI5cw+yMTOR3PGJrehbMdVgErIjP7PwGp74efSA== MIME-Version: 1.0 X-Received: by 10.194.173.233 with SMTP id bn9mr21795138wjc.1.1453094296548; Sun, 17 Jan 2016 21:18:16 -0800 (PST) In-Reply-To: <569C130C.4090706@prochac.sk> References: <201601170055 DOT u0H0to54024329 AT envy DOT delorie DOT com> <569AF06E DOT 1010902 AT prochac DOT sk> <569C130C DOT 4090706 AT prochac DOT sk> Date: Sun, 17 Jan 2016 20:18:16 -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=089e0122f0885eff40052994e144 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 --089e0122f0885eff40052994e144 Content-Type: text/plain; charset=UTF-8 On Sun, Jan 17, 2016 at 1:17 PM, Milan Prochac (milan AT prochac DOT sk) [via geda-user AT delorie DOT com] wrote: > On 17. 1. 2016 22:12, Britton Kerin (britton DOT kerin AT gmail DOT com) [via > geda-user AT delorie DOT com] wrote: > >> >> 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 >> >> > We should address this as separate issue and/or improvement. I do not > want change more than necessary of the original code as part of the feature > implementation. It makes review/testing/rollback easier. Probably a good policy. I put it in launchpad with a note that the intention is to fix it after modular formats are merged. > * 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 >> >> > They are used by built-in PCB format plugin. SavePCB is function in > original PCB code and SavePCB2 is used to transform parameter list. > Currently these are the only functions which really save the PCB layout. Ah my bad cscope fail > * 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. >> >> > IMO the template is not the file which will be edited on daily basis, so > it is not worth too much effort. > Reasonable. We don't want a bunch of synonymous formats anyway of course, but ultimately it might be worth it since a number of loaders could exist. Britton --089e0122f0885eff40052994e144 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Sun, Jan 17, 2016 at 1:17 PM, Milan Prochac (milan AT prochac DOT sk) [via geda-user AT delorie DOT com] <geda-user AT delorie DOT com>= wrote:
On 17. 1. 2016 2= 2:12, Britton Kerin (britton DOT kerin AT gmail DOT com) [via geda-user AT delorie DOT com] wrote:

I ran into a couple more small issues. You're probably already aware bu= t here they are:

* The untrue (failure) result from SavePCBWithFormat() seems totally ignore= d, it should really get an error popup or at the very least a log message s= ince 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() call points o= r if it would need to be further up.=C2=A0 This isn't a problem with yo= ur branch, master has it too.=C2=A0 But it might be easier to fix in your b= ranch 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


We should address this as separate issue and/or improvement.=C2=A0 I do not= want change more than necessary of the original code as part of the featur= e implementation. It makes review/testing/rollback easier.

Probably a good policy.=C2=A0 I put it in launch= pad with a note that the intention is to fix it after modular formats are m= erged.=C2=A0
=C2=A0
* It looks like SavePCB() and SavePCB2() are dead code now so should be rem= oved.=C2=A0 I like to put '// FIXME: I think I'm dead' by stuff= like this but maybe you just remember


They are used by built-in PCB format plugin. SavePCB is function in origina= l PCB code and SavePCB2=C2=A0 is used to transform parameter list. Currentl= y these are the only functions which really save the PCB layout.

Ah my bad cscope fail

=
=C2=A0
* 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#define FORMAT_ID foo
=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 expand 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 argume= nts 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 res= ults.
=C2=A0 =C2=A0 =C2=A0#define EXPAND_AND_CONCAT(arg1, arg2) CONCAT (arg1, arg= 2)
=C2=A0 =C2=A0 =C2=A0#define FORMAT_ID_STRING EXPAND_AND_STRINGIFY (FORMAT_I= D)
=C2=A0 =C2=A0 =C2=A0#define FORMAT_FUNC(arg) EXPAND_AND_CONCAT (arg, FORMAT= _ID)
=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_S= TRING " 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=A0return 0;
=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=A0return 0;
=C2=A0 =C2=A0 =C2=A0}

It's also a good idea to use use static functions for Parse Save etc. p= rovided everything external goes through the pointers in HID_Format, in whi= ch case the function-name generating macro invocations are optional.


IMO the template is not the file which will be edited on daily basis, so it= is not worth too much effort.

Reasonable.=C2=A0 We don't want a bunch of synonymous formats anyway= of course, but ultimately it might be worth it since a number of loaders c= ould exist.
=C2=A0
Britton

--089e0122f0885eff40052994e144--