5 # PCB, interactive printed circuit board design
6 # Copyright (C) 1994,1995,1996 Thomas Nau
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 # Contact addresses for paper mail and Email:
23 # Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
24 # Thomas.Nau@rz.uni-ulm.de
28 # create all objects as defined in passed list_files
30 # usage: CreateLibraryContents.sh common_macro_file file...
35 # Check for input flags
38 while test -n "$1" ; do
42 m4_flags
="$m4_flags -I $2"
48 echo "error: unknown flag $1 to $0"
58 # a TAB plus one blank for some stupid old sed implementations
63 # Make sure we've been given a common file plus at least 1 list file
68 echo "usage: $0 common_macro_file file..." >&2; exit 1
74 # Make sure the common file exists
77 if [ ! -r $CommonFile ]; then
78 echo "$0: file '$CommonFile' isn't readable or doesn't exit" >&2; exit 1
82 # Process the list files
85 while [ $# -ne 0 ]; do
86 # strip the extension '.list'
90 # Turn something like foo.list in to
93 if [ -f $srcdir/$1 ]; then
98 PlainFile
=`dirname $ListFile`/`basename $ListFile .list`
101 if [ ! -r $ListFile ]; then
102 echo "$0: file '$ListFile' isn't readable or doesn't exit" >&2; exit 1
104 if [ ! -r $M4File ]; then
105 echo "$0: file '$M4File' isn't readable or doesn't exit" >&2; exit 1
109 # for foo.list spit out "TYPE=~foo". This defines the library
110 # in the PCB library window
112 echo "TYPE=~`basename $PlainFile | sed -e 's/_/ /g'`"
114 sed -e 's/'"$SPACE"'*#.*$//' \
115 -e 's/'"$SPACE"'*:'"$SPACE"'*/:/g' \
116 -e '/^'"$SPACE"'*$/d' $ListFile |
120 while read mask package values
; do
122 while [ $# -ne 0 ]; do
123 echo "\`$mask:$package:$1:'Description_$mask\` [$package'ifdef(\`Param1_$mask', \` Param1_$mask')\`'ifdef(\`Param2_$mask', \` Param2_$mask')]"
127 } |
$M4 $m4_flags $CommonFile $M4File - |
sed -e '/^'"$SPACE"'*$/d'