[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: stdin:18: m4: Bad expression in eval: (3* - /2)/100,



> > just don't send me ?anything too proprietary. 
> 
> I hope to enter it in the Circuit Cellar AVR contest, but if you win
> with it, more power to you. ?:-)

it turns out I haven't even needed to view the schematic.

I was mislead by a bad assumption on my part earlier.  I thought the
grep footprint= thing would get all footprints, but of course it won't
if you have footprint= attributes in your symbols (in the .sym file)!

So what I did was this:

in your sch directory,

mkdir scheme
cp /usr/pkg/share/gEDA/scheme/* scheme

edit scheme/gnet-gsch2pcb.scm to effect the following change:


--- /usr/pkg/share/gEDA/scheme/gnet-gsch2pcb.scm	Thu Mar  4 20:58:43 2004
+++ scheme/gnet-gsch2pcb.scm	Sat Mar 13 13:56:09 2004
@@ -149,10 +149,5 @@
        (close-port port))
   	;; pipe with the macro define in pcb program
-  	(let ((pipe (open-output-pipe (string-append
-			m4-command " -d -I. -I" m4-pcbdir " "
-			" -I " m4-pcbconfdir " -I$HOME/.pcb -I. "
-			m4-pcbdir "/common.m4 " m4-files " - >> "
-			output-filename))))
-
+  	(let ((pipe (open-output-pipe "cat > pkgs.m4")))
 
 		;; packages is a list with the different refdes value


Now in the ./gnetlistrc file add
;; specify our local scheme directory
(scheme-directory "scheme")

and run

gnetlist -o foo.net -g gsch2pcb i2cbb.sch

Basically this captures the commands which are going to be spit out to the M4 command
which produces the PCB footprints.  If you take a look at pkgs.m4 you'll see

PKG_0805(`0805',`C107',`0.1uF')
PKG_SOIC-8(`SOIC-8',`U105',`unknown')
PKG_SIP10(`SIP10',`KeyPad101',`unknown')
PKG_unknown(`unknown',`C106',`0.33uF')
PKG_0805(`0805',`R104',`10k')
PKG_unknown(`unknown',`C105',`0.1uF')
PKG_unknown(`unknown',`R103',`unknown')
PKG_0805(`0805',`C104',`0.1uF')
PKG_SIP10(`SIP10',`U104',`unknown')
PKG_SO-14(`SO-14',`U103',`unknown')
PKG_SO-16(`SO-16',`U102',`unknown')
PKG_unknown(`unknown',`C103',`1.0uF')
PKG_SOT25(`SOT25',`U101',`unknown')
PKG_unknown(`unknown',`R102',`unknown')
PKG_unknown(`unknown',`R101',`unknown')
PKG_unknown(`unknown',`C102',`0.1uF')
PKG_unknown(`unknown',`C101',`0.33uF')
PKG_unknown(`unknown',`TP104',`unknown')
PKG_unknown(`unknown',`TP103',`unknown')
PKG_unknown(`unknown',`TP102',`unknown')
PKG_unknown(`unknown',`TP101',`unknown')
PKG_HC49(`HC49',`XTAL101',`unknown')

and it was a simple task to feed each of these to the m4 command.
gm4 -I /usr/pkg/packages/pcb-current-20040215/share/pcb/m4 /usr/pkg/packages/pcb-current-20040215/share/pcb/m4/common.m4 pkgs.m4 | & more

So the one it chokes on is PKG_SO-14(`SO-14',`U103',`unknown')

I think the issue is that you can't use a "-" in an m4 macro name.  I know, I know, obscure
little detail.  Maybe one which the PCB developers (maybe me) will have to deal with someday.

So, I'd suggest using SO14 instead of SO-14 as a footprint= name.  The ~geda library in
PCB is becoming more and more complete for standard things like that.

Hope this helps.

-Dan

--