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

gEDA-cvs: pcb.git: branch: master updated (99b23b942f4733a6e3c5333b13c90d6343f340dd)



The branch, master has been updated
       via  99b23b942f4733a6e3c5333b13c90d6343f340dd (commit)
       via  cf5633edad7166066465fbdf4caf826d5d03a31e (commit)
      from  e3774e28567f5ce142e204ab7e525ba954f49581 (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
=========

 src/action.c |   88 ++++++++++++++++++++++++++++++++++++++++++++++------------
 src/change.c |    4 +-
 2 files changed, 72 insertions(+), 20 deletions(-)


=================
 Commit Messages
=================

commit 99b23b942f4733a6e3c5333b13c90d6343f340dd
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Fix bogus cast to BoxType
    
    Instead of casting, which hides real bugs, pass the address of the
    bounding box itself.

:100644 100644 f67e682... db13d5e... M	src/change.c

commit cf5633edad7166066465fbdf4caf826d5d03a31e
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Add more flexibility to the import::make option.
    
    New attributes:
    
    make::outfile - the intermediate action file
    make::target - the makefile target to call (defaults to outfile or pcb_import)
    make::makefile - adds -f to make
    
    Added more documentation too.

:100644 100644 36125d2... d7c754b... M	src/action.c

=========
 Changes
=========

commit 99b23b942f4733a6e3c5333b13c90d6343f340dd
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Fix bogus cast to BoxType
    
    Instead of casting, which hides real bugs, pass the address of the
    bounding box itself.

diff --git a/src/change.c b/src/change.c
index f67e682..db13d5e 100644
--- a/src/change.c
+++ b/src/change.c
@@ -992,13 +992,13 @@ ChangeElementText (PCBType *pcb, DataType *data, ElementTypePtr Element, int whi
     EraseElementName (Element);
 
   r_delete_entry (data->name_tree[which],
-		  (BoxType *) & Element->Name[which].TextString);
+		  & Element->Name[which].BoundingBox);
 
   Element->Name[which].TextString = new_name;
   SetTextBoundingBox (&PCB->Font, &Element->Name[which]);
 
   r_insert_entry (data->name_tree[which],
-		  (BoxType *) & Element->Name[which].TextString, 0);
+		  & Element->Name[which].BoundingBox, 0);
 
   if (pcb && which == NAME_INDEX (pcb))
     DrawElementName (Element, 0);

commit cf5633edad7166066465fbdf4caf826d5d03a31e
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Add more flexibility to the import::make option.
    
    New attributes:
    
    make::outfile - the intermediate action file
    make::target - the makefile target to call (defaults to outfile or pcb_import)
    make::makefile - adds -f to make
    
    Added more documentation too.

diff --git a/src/action.c b/src/action.c
index 36125d2..d7c754b 100644
--- a/src/action.c
+++ b/src/action.c
@@ -7121,17 +7121,49 @@ The name of the .pcb file
 A space-separated list of source files
 
 @item OUT
-The name of the file in which to put the command script.
+The name of the file in which to put the command script, which may
+contain any @pcb{} actions.  By default, this is a temporary file
+selected by @pcb{}, but if you specify an @code{import::outfile}
+attribute, that file name is used instead (and not automatically
+deleted afterwards).
 
 @end table
 
-The target requested will be @code{pcb_import}.
+The target specified to be built is the first of these that apply:
+
+@itemize @bullet
+
+@item
+The target specified by an @code{import::target} attribute.
+
+@item
+The output file specified by an @code{import::outfile} attribute.
+
+@item
+If nothing else is specified, the target is @code{pcb_import}.
+
+@end itemize
+
+If you specify an @code{import::makefile} attribute, then "-f <that
+file>" will be added to the command line.
 
 If you specify the mode, you may also specify the source files
 (schematics).  If you do not specify any, the list of schematics is
 obtained by reading the @code{import::src@var{N}} attributes (like
 @code{import::src0}, @code{import::src1}, etc).
 
+For compatibility with future extensions to the import file format,
+the generated file @emph{must not} start with the two characters
+@code{#%}.
+
+If a temporary file is needed the @code{TMPDIR} environment variable
+is used to select its location.
+
+Note that the programs @code{gnetlist} and @code{make} may be
+overridden by the user via the @code{make-program} and @code{gnetlist}
+@code{pcb} settings (i.e. in @code{~/.pcb/settings} or on the command
+line).
+
 %end-doc */
 
 static int
@@ -7430,19 +7462,36 @@ ActionImport (int argc, char **argv, int x, int y)
     }
   else if (strcasecmp (mode, "make") == 0)
     {
-      char *tmpfile = tempfile_name_new ("gnetlist_output");
-      char **cmd;
+      int must_free_tmpfile = 0;
+      char *tmpfile;
+      char *cmd[10];
       int i;
       char *srclist;
       int srclen;
+      char *user_outfile = NULL;
+      char *user_makefile = NULL;
+      char *user_target = NULL;
 
 
-      if (tmpfile == NULL) {
-	Message ("Could not create temp file");
-	return 1;
-      }
+      user_outfile = AttributeGet (PCB, "import::outfile");
+      user_makefile = AttributeGet (PCB, "import::makefile");
+      user_target = AttributeGet (PCB, "import::target");
+      if (user_outfile && !user_target)
+	user_target = user_outfile;
+
+      if (user_outfile)
+	tmpfile = user_outfile;
+      else
+	{
+	  tmpfile = tempfile_name_new ("gnetlist_output");
+	  if (tmpfile == NULL) {
+	    Message ("Could not create temp file");
+	    return 1;
+	  }
+	  must_free_tmpfile = 1;
+	}
 
-      srclen = sizeof("SRCLIB=") + 2;
+      srclen = sizeof("SRCLIST=") + 2;
       for (i=0; i<nsources; i++)
 	srclen += strlen (sources[i]) + 2;
       srclist = (char *) malloc (srclen);
@@ -7453,25 +7502,28 @@ ActionImport (int argc, char **argv, int x, int y)
 	    strcat (srclist, " ");
 	  strcat (srclist, sources[i]);
 	}
-
-      printf("Makefile!\n");
       
-      cmd = (char **) malloc (7 * sizeof (char *));
       cmd[0] = Settings.MakeProgram;
       cmd[1] = "-s";
       cmd[2] = Concat ("PCB=", PCB->Filename, NULL);
       cmd[3] = srclist;
       cmd[4] = Concat ("OUT=", tmpfile, NULL);
-      cmd[5] = "pcb_import";
-      cmd[6] = NULL;
+      i = 5;
+      if (user_makefile)
+	{
+	  cmd[i++] = "-f";
+	  cmd[i++] = user_makefile;
+	}
+      cmd[i++] = user_target ? user_target : "pcb_import";
+      cmd[i++] = NULL;
 
       if (pcb_spawnvp (cmd))
 	{
-	  unlink (tmpfile);
+	  if (must_free_tmpfile)
+	    unlink (tmpfile);
 	  free (cmd[2]);
 	  free (cmd[3]);
 	  free (cmd[4]);
-	  free (cmd);
 	  return 1;
 	}
 
@@ -7482,8 +7534,8 @@ ActionImport (int argc, char **argv, int x, int y)
       free (cmd[2]);
       free (cmd[3]);
       free (cmd[4]);
-      free (cmd);
-      tempfile_unlink (tmpfile);
+      if (must_free_tmpfile)
+	tempfile_unlink (tmpfile);
     }
   else
     {




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs