Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Nov 2015 09:22:26 +0000 (UTC)
From:      John Marino <marino@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r400642 - head/emulators/mame/files
Message-ID:  <201511020922.tA29MQDD053413@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marino
Date: Mon Nov  2 09:22:26 2015
New Revision: 400642
URL: https://svnweb.freebsd.org/changeset/ports/400642

Log:
  emulators/(mame|mess): Avoid name pollution with <stdio.h>
  
  At least on DragonFly's base compiler (gcc 5.2), the getc and ungetc
  routines in mame/mess were getting clobbered by <stdio.h>.  Rename
  getc and ungetc to mame_getc and mame_ungetc to fix.  For some reason,
  macro definitions did not work so I had to patch every instance
  individually.

Added:
  head/emulators/mame/files/patch-src_lib_netlist_plib_pparser.c   (contents, props changed)
  head/emulators/mame/files/patch-src_lib_netlist_plib_pparser.h   (contents, props changed)

Added: head/emulators/mame/files/patch-src_lib_netlist_plib_pparser.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/mame/files/patch-src_lib_netlist_plib_pparser.c	Mon Nov  2 09:22:26 2015	(r400642)
@@ -0,0 +1,102 @@
+--- src/lib/netlist/plib/pparser.c.orig	2015-09-30 06:29:01 UTC
++++ src/lib/netlist/plib/pparser.c
+@@ -28,22 +28,22 @@ pstring ptokenizer::currentline_str()
+ 
+ void ptokenizer::skipeol()
+ {
+-	pstring::code_t c = getc();
++	pstring::code_t c = mame_getc();
+ 	while (c)
+ 	{
+ 		if (c == 10)
+ 		{
+-			c = getc();
++			c = mame_getc();
+ 			if (c != 13)
+-				ungetc();
++				mame_ungetc();
+ 			return;
+ 		}
+-		c = getc();
++		c = mame_getc();
+ 	}
+ }
+ 
+ 
+-pstring::code_t ptokenizer::getc()
++pstring::code_t ptokenizer::mame_getc()
+ {
+ 	if (m_px >= m_cur_line.len())
+ 	{
+@@ -58,7 +58,7 @@ pstring::code_t ptokenizer::getc()
+ 	return m_cur_line.code_at(m_px++);
+ }
+ 
+-void ptokenizer::ungetc()
++void ptokenizer::mame_ungetc()
+ {
+ 	m_px--;
+ }
+@@ -166,10 +166,10 @@ ptokenizer::token_t ptokenizer::get_toke
+ ptokenizer::token_t ptokenizer::get_token_internal()
+ {
+ 	/* skip ws */
+-	pstring::code_t c = getc();
++	pstring::code_t c = mame_getc();
+ 	while (m_whitespace.find(c)>=0)
+ 	{
+-		c = getc();
++		c = mame_getc();
+ 		if (eof())
+ 		{
+ 			return token_t(ENDOFFILE);
+@@ -189,9 +189,9 @@ ptokenizer::token_t ptokenizer::get_toke
+ 			else if (m_number_chars.find(c)<0)
+ 				break;
+ 			tokstr += c;
+-			c = getc();
++			c = mame_getc();
+ 		}
+-		ungetc();
++		mame_ungetc();
+ 		return token_t(ret, tokstr);
+ 	}
+ 	else if (m_identifier_chars.find(c)>=0)
+@@ -200,9 +200,9 @@ ptokenizer::token_t ptokenizer::get_toke
+ 		pstring tokstr = "";
+ 		while (m_identifier_chars.find(c)>=0) {
+ 			tokstr += c;
+-			c = getc();
++			c = mame_getc();
+ 		}
+-		ungetc();
++		mame_ungetc();
+ 		token_id_t id = token_id_t(m_tokens.indexof(tokstr));
+ 		if (id.id() >= 0)
+ 			return token_t(id, tokstr);
+@@ -214,11 +214,11 @@ ptokenizer::token_t ptokenizer::get_toke
+ 	else if (c == m_string)
+ 	{
+ 		pstring tokstr = "";
+-		c = getc();
++		c = mame_getc();
+ 		while (c != m_string)
+ 		{
+ 			tokstr += c;
+-			c = getc();
++			c = mame_getc();
+ 		}
+ 		return token_t(STRING, tokstr);
+ 	}
+@@ -235,9 +235,9 @@ ptokenizer::token_t ptokenizer::get_toke
+ 				if (id.id() >= 0)
+ 					return token_t(id, tokstr);
+ 			}
+-			c = getc();
++			c = mame_getc();
+ 		}
+-		ungetc();
++		mame_ungetc();
+ 		token_id_t id = token_id_t(m_tokens.indexof(tokstr));
+ 		if (id.id() >= 0)
+ 			return token_t(id, tokstr);

Added: head/emulators/mame/files/patch-src_lib_netlist_plib_pparser.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/mame/files/patch-src_lib_netlist_plib_pparser.h	Mon Nov  2 09:22:26 2015	(r400642)
@@ -0,0 +1,13 @@
+--- src/lib/netlist/plib/pparser.h.orig	2015-09-30 06:29:01 UTC
++++ src/lib/netlist/plib/pparser.h
+@@ -120,8 +120,8 @@ protected:
+ private:
+ 	void skipeol();
+ 
+-	pstring::code_t getc();
+-	void ungetc();
++	pstring::code_t mame_getc();
++	void mame_ungetc();
+ 
+ 	bool eof() { return m_strm.eof(); }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511020922.tA29MQDD053413>