Kaydet (Commit) 239696d9 authored tarafından Michael Stahl's avatar Michael Stahl

vcl: ppdparser.cxx: clean up printf mess to build with dbglevel=11

Change-Id: Ida2b9e3c40205dafaf61ebec67da34d5043c432c
üst 293d31af
...@@ -264,10 +264,6 @@ namespace psp ...@@ -264,10 +264,6 @@ namespace psp
using namespace psp; using namespace psp;
#if OSL_DEBUG_LEVEL > 2
#define BSTRING(x) OUStringToOString( x, osl_getThreadTextEncoding() )
#endif
namespace namespace
{ {
struct thePPDCache : public rtl::Static<PPDCache, thePPDCache> {}; struct thePPDCache : public rtl::Static<PPDCache, thePPDCache> {};
...@@ -486,13 +482,12 @@ void PPDParser::initPPDFiles() ...@@ -486,13 +482,12 @@ void PPDParser::initPPDFiles()
{ {
INetURLObject aDir( aExe ); INetURLObject aDir( aExe );
aDir.removeSegment(); aDir.removeSegment();
#ifdef DEBUG SAL_INFO("vcl.unx.print", "scanning last chance dir: "
fprintf( stderr, "scanning last chance dir: %s\n", OUStringToOString( aDir.GetMainURL( INetURLObject::NO_DECODE ), osl_getThreadTextEncoding() ).getStr() ); << aDir.GetMainURL(INetURLObject::NO_DECODE));
#endif
scanPPDDir( aDir.GetMainURL( INetURLObject::NO_DECODE ) ); scanPPDDir( aDir.GetMainURL( INetURLObject::NO_DECODE ) );
#ifdef DEBUG SAL_INFO("vcl.unx.print", "SGENPRT "
fprintf( stderr, "SGENPRT %s\n", rPPDCache.pAllPPDFiles->find( OUString( "SGENPRT" ) ) == rPPDCache.pAllPPDFiles->end() ? "not found" : "found" ); << (rPPDCache.pAllPPDFiles->find("SGENPRT") ==
#endif rPPDCache.pAllPPDFiles->end() ? "not found" : "found"));
} }
} }
} }
...@@ -629,9 +624,8 @@ const PPDParser* PPDParser::getParser( const OUString& rFile ) ...@@ -629,9 +624,8 @@ const PPDParser* PPDParser::getParser( const OUString& rFile )
aFile = getPPDFile( rFile ); aFile = getPPDFile( rFile );
if( aFile.isEmpty() ) if( aFile.isEmpty() )
{ {
#if OSL_DEBUG_LEVEL > 1 SAL_INFO("vcl.unx.print", "Could not get printer PPD file \""
fprintf( stderr, "Could not get printer PPD file \"%s\" !\n", OUStringToOString( rFile, osl_getThreadTextEncoding() ).getStr() ); << rFile << "\" !");
#endif
return NULL; return NULL;
} }
...@@ -734,12 +728,13 @@ PPDParser::PPDParser( const OUString& rFile ) : ...@@ -734,12 +728,13 @@ PPDParser::PPDParser( const OUString& rFile ) :
// now get the Values // now get the Values
parse( aLines ); parse( aLines );
#if OSL_DEBUG_LEVEL > 2 #if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "acquired %d Keys from PPD %s:\n", m_aKeys.size(), BSTRING( m_aFile ).getStr() ); SAL_INFO("vcl.unx.print", "acquired " << m_aKeys.size()
<< " Keys from PPD " << m_aFile << ":");
for( PPDParser::hash_type::const_iterator it = m_aKeys.begin(); it != m_aKeys.end(); ++it ) for( PPDParser::hash_type::const_iterator it = m_aKeys.begin(); it != m_aKeys.end(); ++it )
{ {
const PPDKey* pKey = it->second; const PPDKey* pKey = it->second;
char* pSetupType = "<unknown>"; char const* pSetupType = "<unknown>";
switch( pKey->m_eSetupType ) switch( pKey->m_eSetupType )
{ {
case PPDKey::ExitServer: pSetupType = "ExitServer";break; case PPDKey::ExitServer: pSetupType = "ExitServer";break;
...@@ -750,18 +745,13 @@ PPDParser::PPDParser( const OUString& rFile ) : ...@@ -750,18 +745,13 @@ PPDParser::PPDParser( const OUString& rFile ) :
case PPDKey::AnySetup: pSetupType = "AnySetup";break; case PPDKey::AnySetup: pSetupType = "AnySetup";break;
default: break; default: break;
}; };
fprintf( stderr, "\t\"%s\" (%d values) OrderDependency: %d %s\n", SAL_INFO("vcl.unx.print", "\t\"" << pKey->getKey() << "\" ("
BSTRING( pKey->getKey() ).getStr(), << pKey->countValues() << "values) OrderDependency: "
pKey->countValues(), << pKey->m_nOrderDependency << pSetupType );
pKey->m_nOrderDependency,
pSetupType );
for( int j = 0; j < pKey->countValues(); j++ ) for( int j = 0; j < pKey->countValues(); j++ )
{ {
fprintf( stderr, "\t\t" );
const PPDValue* pValue = pKey->getValue( j ); const PPDValue* pValue = pKey->getValue( j );
if( pValue == pKey->m_pDefaultValue ) char const* pVType = "<unknown>";
fprintf( stderr, "(Default:) " );
char* pVType = "<unknown>";
switch( pValue->m_eType ) switch( pValue->m_eType )
{ {
case eInvocation: pVType = "invocation";break; case eInvocation: pVType = "invocation";break;
...@@ -771,21 +761,22 @@ PPDParser::PPDParser( const OUString& rFile ) : ...@@ -771,21 +761,22 @@ PPDParser::PPDParser( const OUString& rFile ) :
case eNo: pVType = "no";break; case eNo: pVType = "no";break;
default: break; default: break;
}; };
fprintf( stderr, "option: \"%s\", value: type %s \"%s\"\n", SAL_INFO("vcl.unx.print", "\t\t"
BSTRING( pValue->m_aOption ).getStr(), << (pValue == pKey->m_pDefaultValue ? "(Default:) " : "")
pVType, << "option: \"" << pValue->m_aOption
BSTRING( pValue->m_aValue ).getStr() ); << "\", value: type " << pVType << " \""
<< pValue->m_aValue << "\"");
} }
} }
fprintf( stderr, "constraints: (%d found)\n", m_aConstraints.size() ); SAL_INFO("vcl.unx.print",
"constraints: (" << m_aConstraints.size() << " found)");
for( std::list< PPDConstraint >::const_iterator cit = m_aConstraints.begin(); cit != m_aConstraints.end(); ++cit ) for( std::list< PPDConstraint >::const_iterator cit = m_aConstraints.begin(); cit != m_aConstraints.end(); ++cit )
{ {
fprintf( stderr, "*\"%s\" \"%s\" *\"%s\" \"%s\"\n", SAL_INFO("vcl.unx.print", "*\"" << cit->m_pKey1->getKey() << "\" \""
BSTRING( cit->m_pKey1->getKey() ).getStr(), << (cit->m_pOption1 ? cit->m_pOption1->m_aOption : "<nil>")
cit->m_pOption1 ? BSTRING( cit->m_pOption1->m_aOption ).getStr() : "<nil>", << "\" *\"" << cit->m_pKey2->getKey() << "\" \""
BSTRING( cit->m_pKey2->getKey() ).getStr(), << (cit->m_pOption2 ? cit->m_pOption2->m_aOption : "<nil>")
cit->m_pOption2 ? BSTRING( cit->m_pOption2->m_aOption ).getStr() : "<nil>" << "\"");
);
} }
#endif #endif
...@@ -1347,9 +1338,8 @@ void PPDParser::parseConstraint( const OString& rLine ) ...@@ -1347,9 +1338,8 @@ void PPDParser::parseConstraint( const OString& rLine )
// there must be two keywords // there must be two keywords
if( ! aConstraint.m_pKey1 || ! aConstraint.m_pKey2 || bFailed ) if( ! aConstraint.m_pKey1 || ! aConstraint.m_pKey2 || bFailed )
{ {
#ifdef __DEBUG SAL_INFO("vcl.unx.print",
fprintf( stderr, "Warning: constraint \"%s\" is invalid\n", rLine.getStr() ); "Warning: constraint \"" << rLine << "\" is invalid");
#endif
} }
else else
m_aConstraints.push_back( aConstraint ); m_aConstraints.push_back( aConstraint );
...@@ -1722,13 +1712,12 @@ const PPDValue* PPDContext::setValue( const PPDKey* pKey, const PPDValue* pValue ...@@ -1722,13 +1712,12 @@ const PPDValue* PPDContext::setValue( const PPDKey* pKey, const PPDValue* pValue
if( it->first != pKey && if( it->first != pKey &&
! checkConstraints( it->first, it->second, false ) ) ! checkConstraints( it->first, it->second, false ) )
{ {
#ifdef __DEBUG SAL_INFO("vcl.unx.print", "PPDContext::setValue: option "
fprintf( stderr, "PPDContext::setValue: option %s (%s) is constrained after setting %s to %s\n", << it->first->getKey()
it->first->getKey().GetStr(), << " (" << it->second->m_aOption
it->second->m_aOption.GetStr(), << ") is constrained after setting "
pKey->getKey().GetStr(), << pKey->getKey()
pValue->m_aOption.GetStr() ); << " to " << pValue->m_aOption);
#endif
resetValue( it->first, true ); resetValue( it->first, true );
it = m_aCurrentValues.begin(); it = m_aCurrentValues.begin();
} }
...@@ -1943,9 +1932,11 @@ void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes ) ...@@ -1943,9 +1932,11 @@ void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes )
if (aOption != "*nil") if (aOption != "*nil")
pValue = pKey->getValue( aOption ); pValue = pKey->getValue( aOption );
m_aCurrentValues[ pKey ] = pValue; m_aCurrentValues[ pKey ] = pValue;
#ifdef __DEBUG SAL_INFO("vcl.unx.print",
fprintf( stderr, "PPDContext::rebuildFromStreamBuffer: read PPDKeyValue { %s, %s }\n", pKV->m_pKey->getKey().GetStr(), pKV->m_pCurrentValue ? pKV->m_pCurrentValue->m_aOption.GetStr() : "<nil>" ); "PPDContext::rebuildFromStreamBuffer: read PPDKeyValue { "
#endif << pKey->getKey() << " , "
<< (pValue ? aOption : "<nil>")
<< " }");
} }
} }
nBytes -= aLine.getLength()+1; nBytes -= aLine.getLength()+1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment