[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.7.0-20110116-111-g9538145)
The branch, master has been updated
via 9538145da79933763ed79eae6869f92d467e10d0 (commit)
via 220ecbd09393ae0d8cc43d26cfe7c8427888c744 (commit)
from 718f4b5487b458ca5b48f46b0d7cad35d1f6acde (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
gnetlist/include/globals.h | 2 +
gnetlist/include/prototype.h | 2 +
gnetlist/scheme/Makefile.am | 2 +-
gnetlist/scheme/gnet-makedepend.scm | 113 +++++++++++++++++++++++++++++++++++
gnetlist/src/g_netlist.c | 20 ++++++
gnetlist/src/g_register.c | 1 +
gnetlist/src/globals.c | 3 +
gnetlist/src/gnetlist.c | 5 ++
8 files changed, 147 insertions(+), 1 deletions(-)
create mode 100644 gnetlist/scheme/gnet-makedepend.scm
=================
Commit Messages
=================
commit 9538145da79933763ed79eae6869f92d467e10d0
Author: Dan White <dan@xxxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
gnetlist: makedepend backend
Gnetlist backend to determine a schematic's dependencies. Output
is in the form of:
source.sch: depend1.sch depend2.sch
source.cir: source.sch depend1.cir depend2.cir other.inc
...written to "source.d" file for inclusion into a project's
Makefile.
First line collects all source= attributes in the input pages. Second
line lists transformed source='s/sch/cir/' and file= attributes
(.include files).
Affects-bug: lp-698740
Reviewed-by: Peter TB Brett <peter@xxxxxxxxxxxxx>
:100644 100644 11fdc4e... d6ecf03... M gnetlist/scheme/Makefile.am
:000000 100644 0000000... 44eabfd... A gnetlist/scheme/gnet-makedepend.scm
commit 220ecbd09393ae0d8cc43d26cfe7c8427888c744
Author: Dan White <dan@xxxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
Add gnetlist:get-input-files scheme function.
Returns the list of files loaded by gnetlist. This returns the last elements
of gnetlist:get-command-line not consumed by getopt.
Affects-bug: lp-698740
Reviewed-by: Peter TB Brett <peter@xxxxxxxxxxxxx>
:100644 100644 7ab92bf... d042967... M gnetlist/include/globals.h
:100644 100644 99e0094... d775c5e... M gnetlist/include/prototype.h
:100644 100644 8b97a37... 01cdeb1... M gnetlist/src/g_netlist.c
:100644 100644 71a2049... 9c0d9e5... M gnetlist/src/g_register.c
:100644 100644 2d7a2af... e24f549... M gnetlist/src/globals.c
:100644 100644 79eec78... cb6ff50... M gnetlist/src/gnetlist.c
=========
Changes
=========
commit 9538145da79933763ed79eae6869f92d467e10d0
Author: Dan White <dan@xxxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
gnetlist: makedepend backend
Gnetlist backend to determine a schematic's dependencies. Output
is in the form of:
source.sch: depend1.sch depend2.sch
source.cir: source.sch depend1.cir depend2.cir other.inc
...written to "source.d" file for inclusion into a project's
Makefile.
First line collects all source= attributes in the input pages. Second
line lists transformed source='s/sch/cir/' and file= attributes
(.include files).
Affects-bug: lp-698740
Reviewed-by: Peter TB Brett <peter@xxxxxxxxxxxxx>
diff --git a/gnetlist/scheme/Makefile.am b/gnetlist/scheme/Makefile.am
index 11fdc4e..d6ecf03 100644
--- a/gnetlist/scheme/Makefile.am
+++ b/gnetlist/scheme/Makefile.am
@@ -21,7 +21,7 @@ DIST_SCM = gnet-PCB.scm gnet-allegro.scm gnet-bom.scm gnet-geda.scm \
gnet-redac.scm gnet-systemc.scm gnet-eagle.scm \
gnet-pcbpins.scm gnet-calay.scm gnet-osmond.scm \
gnet-mathematica.scm gnet-liquidpcb.scm \
- gnetlist/backend-getopt.scm
+ gnetlist/backend-getopt.scm gnet-makedepend.scm
EXTRA_DIST = $(DIST_SCM) $(SCM_SRCS)
diff --git a/gnetlist/scheme/gnet-makedepend.scm b/gnetlist/scheme/gnet-makedepend.scm
new file mode 100644
index 0000000..44eabfd
--- /dev/null
+++ b/gnetlist/scheme/gnet-makedepend.scm
@@ -0,0 +1,113 @@
+;;; gEDA - GPL Electronic Design Automation
+;;; gnetlist - gEDA Netlist
+;;; Copyright (C) 2011 Dan White <dan@xxxxxxxxxxxxxx>
+;;;
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 2 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with this program; if not, write to the Free Software
+;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;;
+;; --------------------------------------------------------------------------
+;;
+;; Backend to determine the dependencies of a given schematic.
+;;
+;; Output is Makefile lines relevant to the input schematic(s):
+;;
+;; foo.sch: subsheetA.sch subsheetB.sch
+;; foo.cir: foo.sch subsheetA.cir subsheetB.cir
+;;
+;; See the following for the intended usage:
+;; http://www.gnu.org/software/make/manual/make.html#Automatic-Prerequisites
+;;
+;; --------------------------------------------------------------------------
+;;
+
+
+(use-modules (ice-9 regex))
+(use-modules (srfi srfi-1))
+
+
+
+; Split a filename into 3 parts:
+; 1- base name
+; 2- page number
+; 3- extension
+;
+; base_nam3-#.ext -> [[:alnum:]_]+-[:digit:]+.ext
+(define makedepend-scheme
+ "([[:alnum:]_]+)-([[:digit:]]+).([[:alpha:]]+)$")
+
+(define (makedepend:split-filename makedepend-scheme name)
+ (let* ((match (string-match makedepend-scheme name))
+ (base (match:substring match 1))
+ (page (match:substring match 2))
+ (ext (match:substring match 3))
+ )
+ (list base page ext)
+ )
+)
+
+
+
+;;
+;; Returns a list of all values found for the given attribute name
+;; over all packages in the input files.
+;;
+(define (makedepend:get-all-attr-values attribute packages)
+ ;split individual values (gschem wants a single comma-sep list for source=)
+ (append-map (lambda (str) (string-split str #\,))
+ ;ignore non-existent values
+ (delete #f
+ ;collect values from all packages into a list
+ (append-map
+ ;get all values for a given refdes
+ (lambda (x) (gnetlist:get-all-package-attributes x attribute))
+ packages)))
+)
+
+
+
+(define (makedepend:output-make-command input-files sources files port)
+ (let* (;lazy version, use first filename only for naming scheme
+ (scheme-split (makedepend:split-filename makedepend-scheme (car input-files)))
+ (base (first scheme-split))
+ (page (second scheme-split))
+ (ext (third scheme-split))
+ )
+
+ ;schematic deps
+ (format port "~a: ~a\n"
+ (string-join input-files " ")
+ (string-join sources " "))
+
+ ;netlist deps
+ (format port "~a.cir: ~a ~a\n"
+ base
+ (string-join input-files " ")
+ (string-join files " "))
+ )
+)
+
+
+
+(define (makedepend output-filename)
+ (let* ((port (open-output-file output-filename))
+ (source-attrs (makedepend:get-all-attr-values "source" packages))
+ (file-attrs (makedepend:get-all-attr-values "file" packages))
+ (input-files (gnetlist:get-input-files))
+ )
+ (makedepend:output-make-command input-files source-attrs file-attrs port)
+ (close-output-port port)
+ )
+)
+
+;; vim:shiftwidth=2
commit 220ecbd09393ae0d8cc43d26cfe7c8427888c744
Author: Dan White <dan@xxxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
Add gnetlist:get-input-files scheme function.
Returns the list of files loaded by gnetlist. This returns the last elements
of gnetlist:get-command-line not consumed by getopt.
Affects-bug: lp-698740
Reviewed-by: Peter TB Brett <peter@xxxxxxxxxxxxx>
diff --git a/gnetlist/include/globals.h b/gnetlist/include/globals.h
index 7ab92bf..d042967 100644
--- a/gnetlist/include/globals.h
+++ b/gnetlist/include/globals.h
@@ -38,3 +38,5 @@ extern SCM pre_rc_list; /* before rc loaded */
extern SCM pre_backend_list; /* before backend loaded */
extern SCM post_backend_list; /* after backend loaded, before execute */
extern GSList *backend_params; /* Parameters passed to the backend from the command line */
+
+extern GSList *input_files;
diff --git a/gnetlist/include/prototype.h b/gnetlist/include/prototype.h
index 99e0094..d775c5e 100644
--- a/gnetlist/include/prototype.h
+++ b/gnetlist/include/prototype.h
@@ -2,6 +2,7 @@
void g_set_project_current(TOPLEVEL *pr_current);
SCM g_scm_c_get_uref(TOPLEVEL *toplevel, OBJECT *object);
SCM g_get_backend_arguments ();
+SCM g_get_input_files();
SCM g_get_packages(SCM level);
SCM g_get_non_unique_packages(SCM level);
SCM g_get_pins(SCM uref);
@@ -42,6 +43,7 @@ int main(int argc, char *argv[]);
void i_vars_set(TOPLEVEL *pr_current);
/* parsecmd.c */
void usage(char *cmd);
+GSList *create_input_files_list(int argi, int argc, char *argv[]);
int parse_commandline(int argc, char *argv[]);
/* s_cpinlist.c */
CPINLIST *s_cpinlist_return_tail(CPINLIST *head);
diff --git a/gnetlist/src/g_netlist.c b/gnetlist/src/g_netlist.c
index 8b97a37..01cdeb1 100644
--- a/gnetlist/src/g_netlist.c
+++ b/gnetlist/src/g_netlist.c
@@ -749,6 +749,26 @@ g_get_backend_arguments()
}
+/*! \brief Get input files from command line.
+ * \par Function Description
+ * This function returns a list of the files named on the command line.
+ *
+ * \return A list of filenames as strings.
+ */
+SCM g_get_input_files()
+{
+ SCM list = SCM_EOL;
+ GSList *current = input_files;
+
+ while (current != NULL) {
+ list = scm_cons (scm_from_locale_string (current->data), list);
+ current = g_slist_next(current);
+ }
+
+ return scm_reverse_x (list, SCM_EOL);
+}
+
+
/* given a net name, an attribute, and a wanted attribute, return all
the given attribute of all the graphical objects connected to that
net name */
diff --git a/gnetlist/src/g_register.c b/gnetlist/src/g_register.c
index 71a2049..9c0d9e5 100644
--- a/gnetlist/src/g_register.c
+++ b/gnetlist/src/g_register.c
@@ -94,6 +94,7 @@ static struct gsubr_t gnetlist_funcs[] = {
/* SDB -- 9.1.2003 */
{ "gnetlist:get-backend-arguments", 0, 0, 0, g_get_backend_arguments },
+ { "gnetlist:get-input-files", 0, 0, 0, g_get_input_files },
{ NULL, 0, 0, 0, NULL } };
diff --git a/gnetlist/src/globals.c b/gnetlist/src/globals.c
index 2d7a2af..e24f549 100644
--- a/gnetlist/src/globals.c
+++ b/gnetlist/src/globals.c
@@ -63,5 +63,8 @@ SCM pre_backend_list = SCM_EOL;
* before the execution of the backend procedure */
SCM post_backend_list = SCM_EOL;
+/* List of input filenames */
+GSList *input_files;
+
/* Parameters passed to the backend from the command line */
GSList *backend_params = NULL;
diff --git a/gnetlist/src/gnetlist.c b/gnetlist/src/gnetlist.c
index 79eec78..cb6ff50 100644
--- a/gnetlist/src/gnetlist.c
+++ b/gnetlist/src/gnetlist.c
@@ -54,6 +54,8 @@ void gnetlist_quit(void)
/* Free GSList *backend_params */
g_slist_free (backend_params);
+
+ g_slist_free (input_files);
}
@@ -228,6 +230,9 @@ void main_prog(void *closure, int argc, char *argv[])
g_error_free (err);
}
+ /* collect input filenames for backend use */
+ input_files = g_slist_append(input_files, argv[i]);
+
i++;
g_free (filename);
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs