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

gEDA-cvs: CVS update: convert_sym.c



  User: pcjc2   
  Date: 07/02/11 18:59:11

  Modified:    .        Tag: noscreen convert_sym.c gsch2pcb.c
  Log:
  Sync with trunc
  
  
  
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.15.2.2  +5 -3      eda/geda/gaf/utils/src/convert_sym.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: convert_sym.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/utils/src/convert_sym.c,v
  retrieving revision 1.15.2.1
  retrieving revision 1.15.2.2
  diff -u -b -r1.15.2.1 -r1.15.2.2
  --- convert_sym.c	27 Dec 2006 17:37:58 -0000	1.15.2.1
  +++ convert_sym.c	11 Feb 2007 23:59:10 -0000	1.15.2.2
  @@ -33,7 +33,7 @@
    *   along with this program; if not, write to the Free Software
    *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
    *
  - * 	$Id: convert_sym.c,v 1.15.2.1 2006/12/27 17:37:58 pcjc2 Exp $	 
  + * 	$Id: convert_sym.c,v 1.15.2.2 2007/02/11 23:59:10 pcjc2 Exp $	 
    */
   
   #include <stdio.h>
  @@ -65,7 +65,7 @@
   #endif
   
   #ifndef lint
  -static char vcid[] ATTRIBUTE_UNUSED = "$Id: convert_sym.c,v 1.15.2.1 2006/12/27 17:37:58 pcjc2 Exp $";
  +static char vcid[] ATTRIBUTE_UNUSED = "$Id: convert_sym.c,v 1.15.2.2 2007/02/11 23:59:10 pcjc2 Exp $";
   #endif /* lint */
   
   #ifndef OPTARG_IN_UNISTD
  @@ -514,7 +514,9 @@
   	case 'X':  /* unconnected pin record */
   	  do_nop(fp);
   	  break;
  -
  +	case '|':  /* some kind of timestamp */
  +	  do_nop(fp);
  +	  break;
   	default: /* just read in the record and trash it */
   	  fgets(buf, MAX_TEXTLEN, fp);
   	  /* nuke trailing CR, if there */
  
  
  
  1.12.6.1  +65 -47    eda/geda/gaf/utils/src/gsch2pcb.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: gsch2pcb.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/utils/src/gsch2pcb.c,v
  retrieving revision 1.12
  retrieving revision 1.12.6.1
  diff -u -b -r1.12 -r1.12.6.1
  --- gsch2pcb.c	5 Apr 2006 02:32:27 -0000	1.12
  +++ gsch2pcb.c	11 Feb 2007 23:59:10 -0000	1.12.6.1
  @@ -1,4 +1,4 @@
  -/* $Id: gsch2pcb.c,v 1.12 2006/04/05 02:32:27 danmc Exp $ */
  +/* $Id: gsch2pcb.c,v 1.12.6.1 2007/02/11 23:59:10 pcjc2 Exp $ */
   
   /* gsch2pcb
   |
  @@ -41,10 +41,12 @@
   #include <dmalloc.h>
   #endif
   
  -#define	GSC2PCB_VERSION		"1.5"
  +#define	GSC2PCB_VERSION		"1.6"
   
   #define	DEFAULT_PCB_INC		"pcb.inc"
   
  +#define SEP_STRING 	"--------\n"
  +
   typedef struct
   	{
   	gchar		*refdes,
  @@ -88,6 +90,8 @@
   				*m4_files,
   				*m4_override_file;
   
  +static gboolean use_m4 = FALSE;
  +
   static gchar	*empty_footprint_name;
   
   static gint		verbose,
  @@ -118,8 +122,6 @@
   	{
   	FILE	*f;
   
  -	if (!m4_command && !m4_pcbdir && !m4_files)
  -		return;
   	m4_override_file = "gnet-gsch2pcb-tmp.scm";
   	f = fopen(m4_override_file, "w");
   	if (!f)
  @@ -133,6 +135,8 @@
   		fprintf(f, "(define m4-pcbdir \"%s\")\n", m4_pcbdir);
   	if (m4_files)
   		fprintf(f, "(define m4-files \"%s\")\n", m4_files);
  +	fprintf(f, "(define gsch2pcb:use-m4 %s)\n", use_m4 == TRUE ? "#t" : "#f");
  +
   	fclose(f);
   	if (verbose)
   		{
  @@ -144,6 +148,7 @@
   			printf("    (define m4-pcbdir \"%s\")\n", m4_pcbdir);
   		if (m4_files)
   			printf("    (define m4-files \"%s\")\n", m4_files);
  +		printf("    (define gsch2pcb:use-m4 %s)\n", use_m4 == TRUE ? "#t" : "#f");
   		}
   	}
   
  @@ -179,7 +184,7 @@
   		command = g_strconcat(
   					gnetlist, " -g pcbpins -o ", pins_file, " ", args, NULL);
   		printf("Running command:\n\t%s\n", command);
  -		printf("--------\n");
  +		printf(SEP_STRING);
   		}
   	else
   		command = g_strconcat(
  @@ -192,7 +197,7 @@
   		command = g_strconcat(
   					gnetlist, " -g PCB -o ", net_file, " ", args, NULL);
   		printf("Running command:\n\t%s\n", command);
  -		printf("--------\n");
  +		printf(SEP_STRING);
   		}
   	else
   		command = g_strconcat(
  @@ -210,11 +215,11 @@
   	
   	if (verbose)
   		{
  -		printf("--------\n");
  +		printf(SEP_STRING);
   		command = g_strconcat(gnetlist, " -g gsch2pcb -o ", pcb_file, 
   				" ", args1, NULL);
   		printf("Running command:\n\t%s\n", command);
  -		printf("--------\n");
  +		printf(SEP_STRING);
   		}
   	else
   		command = g_strconcat(gnetlist, " -q -g gsch2pcb -o ", pcb_file, 
  @@ -223,7 +228,7 @@
   	g_spawn_command_line_sync(command, NULL, NULL, NULL, NULL);
   
   	if (verbose)
  -		printf("--------\n");
  +		printf(SEP_STRING);
   
   	if (   stat(pcb_file, &st) != 0
   		|| mtime == st.st_mtime
  @@ -250,11 +255,11 @@
   
   		if (verbose)
   			{
  -			printf("--------\n");
  +			printf(SEP_STRING);
   			command = g_strconcat(gnetlist, " -g ", s, out_file,
   							" ", args, NULL);
   			printf("Running command:\n\t%s\n", command);
  -			printf("--------\n");
  +			printf(SEP_STRING);
   			}
   		else
   			command = g_strconcat(gnetlist, " -q -g ", s, out_file,
  @@ -264,7 +269,7 @@
   		g_free(command);
   		g_free(out_file);
   		if (verbose)
  -			printf("--------\n");
  +			printf(SEP_STRING);
   		}
   	}
   
  @@ -564,25 +569,37 @@
   
   	if ((dir = g_dir_open(dir_path, 0, NULL)) == NULL)
   		{
  -		s = g_strdup_printf("find_element can't open dir %s", dir_path);
  +		s = g_strdup_printf("find_element can't open dir \"%s\"", dir_path);
   		perror(s);
   		g_free(s);
   		return NULL;
   		}
   	if (verbose > 1)
  -			printf("\t  Searching: %s\n", dir_path);
  +			printf("\t  Searching: \"%s\" for \"%s\"\n", dir_path, element);
   	while ((name = (gchar *) g_dir_read_name(dir)) != NULL)
   		{
   		path = g_strconcat(dir_path, "/", name, NULL);
   		found = NULL;
  +
  +		/* if we got a directory name, then recurse down into it */
   		if (g_file_test(path, G_FILE_TEST_IS_DIR))
   			found = find_element(path, element);
  +
  +		/* otherwise assume it is a file and see if it is the one we want */
   		else
   			{
   			if (verbose > 1)
   				printf("\t           : %s\t", name);
   			if (!strcmp(name, element))
   				found = g_strdup(path);
  +			else
  +			  {
  +				gchar *tmps;
  +				tmps = g_strconcat (element, ".fp", NULL);
  +				if (!strcmp(name, tmps))
  +					found = g_strdup(path);
  +				g_free (tmps);
  +			  }
   			if (verbose > 1)
   				printf("%s\n", found ? "Yes" : "No");
   			}
  @@ -647,7 +664,7 @@
   		{
   		dir_path = (gchar *) list->data;
   		if (verbose > 1)
  -			printf("\tLooking in directory: %s\n", dir_path);
  +			printf("\tLooking in directory: \"%s\"\n", dir_path);
   		path = find_element(dir_path, elname);
   		if (path)
   			{
  @@ -1178,6 +1195,11 @@
   		force_element_files = TRUE;
   		return 0;
   		}
  +	if (!strcmp(config, "use-m4") || !strcmp(config, "f"))
  +		{
  +		use_m4 = TRUE;
  +		return 0;
  +		}
   	if (!strcmp(config, "elements-dir") || !strcmp(config, "d"))
   		{
   		if (verbose > 1)
  @@ -1301,6 +1323,8 @@
   "                         so you really shouldn't need this option.\n"
   "   -q, --quiet           Don't tell the user what to do next after running gsch2pcb.\n"
   "\n"
  +"   -m, --use-m4          Use m4 when looking for footprints.  The default is to not\n"
  +"                         run m4 at all.\n"
   "       --m4-file F.inc   Use m4 file F.inc in addition to the default m4\n"
   "                         files ./pcb.inc and ~/.pcb/pcb.inc.\n"
   "       --m4-pcbdir D     Use D as the PCB m4 files install directory\n"
  @@ -1409,21 +1433,16 @@
   	gint	i;
   	gboolean initial_pcb = TRUE;
   	gboolean created_pcb_file = TRUE;
  +	char *path, *p;
   
   	if (argc < 2)
   		usage();
   
  -	/* Default m4 dir was /usr/X11R6/lib/X11/pcb/m4, but in more recent
  -	|  pcb versions it's under /usr/share or /usr/local/share
  +	/* Use the default value passed in from the configure script instead
  +  	 * of trying to hard code a value which is very likely wrong
   	*/
  -	if (g_file_test("/usr/local/share/pcb/m4", G_FILE_TEST_IS_DIR))
  -		m4_pcbdir = g_strdup("/usr/local/share/pcb/m4");
  -	else if (g_file_test("/usr/share/pcb/m4", G_FILE_TEST_IS_DIR))
  -		m4_pcbdir = g_strdup("/usr/share/pcb/m4");
  -	default_m4_pcbdir = g_strdup(m4_pcbdir ?
  -		   m4_pcbdir
  -		: "/usr/X11R6/lib/X11/pcb/m4" /* hardwired in gnet-gsch2pcb.scm */);
  -
  +	m4_pcbdir = g_strconcat( PCBDATADIR, "/pcb/m4", NULL );
  +	default_m4_pcbdir = g_strdup(m4_pcbdir);
   
   	get_args(argc, argv);
   
  @@ -1434,29 +1453,28 @@
   		usage();
   
   
  -	/* Hardwire in directories from Pcb.ad.  PCB as of 20031113 uses share
  -	|  instead of lib.  Check for standard prefix dirs of /usr and /usr/local.
  -	|  If PCB is installed elsewhere (eg. /opt) there will need to be a project
  -	|  elements-dir line.
  -	*/
  +	/* Defaults for the search path if not configured in the project file */
   	if (g_file_test("packages", G_FILE_TEST_IS_DIR))
   		element_directory_list = g_list_append(element_directory_list,
   					"packages");
  -	if (g_file_test("/usr/local/share/pcb/newlib", G_FILE_TEST_IS_DIR))
  -		element_directory_list = g_list_append(element_directory_list,
  -					"/usr/local/share/pcb/newlib");
  -	if (g_file_test("/usr/share/pcb/newlib", G_FILE_TEST_IS_DIR))
  -		element_directory_list = g_list_append(element_directory_list,
  -					"/usr/share/pcb/newlib");
  -	if (g_file_test("/usr/local/lib/pcb_lib", G_FILE_TEST_IS_DIR))	/* old */
  -		element_directory_list = g_list_append(element_directory_list,
  -					"/usr/local/lib/pcb_lib");
  -	if (g_file_test("/usr/lib/pcb_lib", G_FILE_TEST_IS_DIR))		/* old */
  -		element_directory_list = g_list_append(element_directory_list,
  -					"/usr/lib/pcb_lib");
  -	if (g_file_test("/usr/local/pcb_lib", G_FILE_TEST_IS_DIR))		/* old */
  +
  +#define PCB_PATH_DELIMETER ":"
  +	if (verbose)
  +		printf ("Processing PCBLIBPATH=\"%s\"\n", PCBLIBPATH);
  +
  +	path = g_strdup (PCBLIBPATH);
  +	for (p = strtok (path, PCB_PATH_DELIMETER); p && *p;
  +		p = strtok (NULL, PCB_PATH_DELIMETER))
  +	  {
  +		if (g_file_test(p, G_FILE_TEST_IS_DIR))
  +		  {
  +			if (verbose)
  +				printf ("Adding %s to the newlib search path\n", p);
   		element_directory_list = g_list_append(element_directory_list,
  -					"/usr/local/pcb_lib");
  +					g_strdup(p));
  +		  }
  +	  }
  +	g_free (path);
   
   	pins_file_name = g_strconcat(basename, ".cmd", NULL);
   	net_file_name = g_strconcat(basename, ".net", NULL);
  @@ -1568,7 +1586,7 @@
   			printf("\nNext step:\n");
   			printf("1.  Run pcb on your file %s.\n", pcb_file_name);
   			printf("    You will find all your footprints in a bundle ready for you to place\n");
  -			printf("    or disperse with \"File -> Disperse all elements\" in PCB\n\n");
  +			printf("    or disperse with \"Select -> Disperse all elements\" in PCB.\n\n");
   			printf("2.  From within PCB, select \"File -> Load netlist file\" and select \n");
   			printf("    %s to load the netlist.\n\n", net_file_name);
   			printf("3.  From within PCB, enter\n\n");
  
  
  


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