smlparse.cpp
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:879k
- {
- goto exit;
- }
- }
- // /"systemAudioDesc", "systemOperatingSystem", and "systemCPU" were
- // introduced in SMIL 2.0:
- // /XXXEH- TODO: We need to coordinate with TLC folks to make this a
- // user-settable option:
- rc = pNode->m_pValues->GetPropertyCString("systemAudioDesc", pBuf);
- if(HXR_OK == rc)
- {
- const char* pActualValue = (const char*)pBuf->GetBuffer();
- if(strcmp(pActualValue, "on") == 0)
- {
- if(!m_bSystemAudioDescPreference)
- {
- bFailed = TRUE;
- }
- }
- else
- {
- if(m_bSystemAudioDescPreference)
- {
- bFailed = TRUE;
- }
- }
- pBuf->Release();
- if(bFailed)
- {
- goto exit;
- }
- }
- rc = pNode->m_pValues->GetPropertyCString("systemOperatingSystem",
- pBuf);
- if(HXR_OK == rc && HX_PLATFORM_UNKNOWN!=m_versionInfo.dwPlatformId)
- {
- #if defined(_MACINTOSH) || defined(_MAC_UNIX) // /Sanity check on Mac platform id:
- HX_ASSERT(HX_PLATFORM_MACOT == m_versionInfo.dwPlatformId ||
- HX_PLATFORM_MACTCP == m_versionInfo.dwPlatformId);
- #endif
- const char* pOS = (const char*)pBuf->GetBuffer();
- // /First, strip leading whitespace chars:
- while (*pOS && isspace(*pOS))
- {
- *pOS++;
- }
- /*fixes PR 64428 (UseSystemOS version)*/
- if (!m_bUseSystemOS)
- {
- // /Fixes PR 81522 (systemOperatingSystem version): if user
- // says not to use OS info, treat it as unknown per SMIL2 spec:
- bFailed = FALSE; // /Setting to FALSE instead of comparing to
- // "unknown" fixes OS part of PR 64428(revisted)
- goto doneSysOS;
- }
- // /From the SMIL 2.0 CR spec:
- // "The following list contains the suggested values for this
- // test attribute (additional names may be supported by an
- // implementation):
- // aix, beos, bsdi, dgux, freebsd, hpux, irix, linux,
- // macos, ncr, nec, netbsd, nextstep, nto, openbsd, openvms,
- // os2, osf, palmos, qnx, sinix, rhapsody, sco, solaris,
- // sonly, sunos, unixware, win16, win32, win9x, winnt,
- // wince, unknown"
- // /NOTE: current Mozilla list can be found here:
- // http://lxr.mozilla.org/seamonkey/search?string=_PR_SI_SYSNAME
- switch (m_versionInfo.dwPlatformId)
- {
- case HX_PLATFORM_IRIX:
- {
- if (0 != strcmp("irix", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_PLATFORM_LINUX:
- {
- if (0 != strcmp("linux", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_PLATFORM_MACOT:
- case HX_PLATFORM_MACTCP:
- {
- if (0 != strcmp("macos", pOS))
- {
- bFailed = TRUE;
- // _DARWIN, _CARBON, and/or _MAC_UNIX implies Darwin is present on a Mac:
- #if defined(_DARWIN) || defined(_CARBON) || defined(_MAC_UNIX)
- // /Fixes PR 95625: Also check for darwin (UNIX on Mac):
- bFailed = (0 != strcmp("darwin", pOS));
- #endif // / _DARWIN || _CARBON || _MAC_UNIX.
- }
- }
- break;
- case HX_PLATFORM_QNXNTO:
- { // /We should assert! But, hey, it might come back 8-]
- if (0 != strcmp("qnx", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_PLATFORM_SOLARIS:
- case HX_PLATFORM_SUNOS:
- {
- // /These are the same since RN started porting to them:
- if (0 != strcmp("solaris", pOS) &&
- 0 != strcmp("sunos", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_PLATFORM_WIN16:
- { // /We should really assert! But, it might come back 8-]
- if (0 != strcmp("win16", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_PLATFORM_WIN32S:// /XXXEH is Win32s always on Win16??
- {
- if (0 != strcmp("win16", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_PLATFORM_WIN95:
- case HX_PLATFORM_WIN98:
- {
- if (0 != strcmp("win9x", pOS) &&
- 0 != strcmp("win32", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_PLATFORM_WINNT:
- {
- if (0 != strcmp("winnt", pOS) &&
- 0 != strcmp("win32", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_PLATFORM_SYMBIAN:
- {
- if (0 != strcmp("symbian", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_PLATFORM_UNKNOWN:
- {
- if (0 != strcmp("unknown", pOS))
- {
- bFailed = TRUE;
- }
- }
- break;
- default:
- {
- // /The following SMIL 2.0 systemOperatingSystem values
- // are not covered in HXGetWinVer as of 12/2000:
- // XXXaix, XXXbeos, bsdi, dgux, freebsd, XXXhpux, ncr,
- // nec, netbsd, nextstep, nto, openbsd, openvms,
- // os2, XXXosf, palmos, sinix, rhapsody, XXXsco,
- // sonly, unixware, wince
- #if defined(_AIX)
- if (0 != strcmp("aix", pOS))
- {
- bFailed = TRUE;
- }
- #elif defined(_BEOS)
- if (0 != strcmp("beos", pOS))
- {
- bFailed = TRUE;
- }
- #elif defined(_BSDI)
- if (0 != strcmp("bsdi", pOS))
- {
- bFailed = TRUE;
- }
- // _DARWIN, _CARBON, and/or _MAC_UNIX implies Darwin is present on a Mac:
- #elif defined(_DARWIN) || defined(_CARBON) || defined(_MAC_UNIX)
- // /Fixes PR 95625 (in case HX_PLATFORM_MAC... is not
- // handled, above):
- if (0 != strcmp("darwin", pOS))
- {
- bFailed = TRUE;
- }
- #elif defined(_FREEBSD) || defined(_FREEBSD2)
- if (0 != strcmp("freebsd", pOS))
- {
- bFailed = TRUE;
- }
- #elif defined(_HPUX)
- if (0 != strcmp("hpux", pOS))
- {
- bFailed = TRUE;
- }
- #elif defined(_NETBSD) || defined(__NetBSD__)
- if (0 != strcmp("netbsd", pOS))
- {
- bFailed = TRUE;
- }
- #elif defined(_OSF1)
- if (0 != strcmp("osf", pOS))
- {
- bFailed = TRUE;
- }
- #elif defined(_SCO_UW)
- if (0 != strcmp("sco", pOS))
- {
- bFailed = TRUE;
- }
- #elif defined(_WINCE)
- if (0 != strcmp("wince", pOS))
- {
- bFailed = TRUE;
- }
- // /SGI is not in the SMIL 2.0 spec, but the spec says we can add more than
- // the OSes it recommends:
- #elif defined(_SGI)
- if (0 != strcmp("sgi", pOS))
- {
- bFailed = TRUE;
- }
- #else // /Catch-all for any other OS; throw an error at compile time:
- /* Please add to the above list with your OS's define and match it to
- one of the following (or add a string if it's not in the following list and
- be sure to tell RN documentation folks about it):
- "dgux", "ncr", "nec", "nextstep", "nto", "openbsd", "openvms", "os2",
- "palmos", "sinix", "rhapsody", "sonly", "unixware"
- */
- #endif
- }
- break;
- }
- if (bFailed && 0 == strcmp("unknown", pOS))
- {
- bFailed = FALSE; // /"unknown should play on any OS"
- }
- doneSysOS:
- HX_RELEASE(pBuf);
- if(bFailed)
- {
- goto exit;
- }
- }
- rc = pNode->m_pValues->GetPropertyCString("systemCPU", pBuf);
- if(HXR_OK == rc && HX_MACHINE_UNKNOWN!=m_versionInfo.dwMachineType)
- {
- const char* pCPU = (const char*)pBuf->GetBuffer();
- // /First, strip leading whitespace chars:
- while (*pCPU && isspace(*pCPU))
- {
- *pCPU++;
- }
- /*fixes PR 64428 (UseSystemCPU version)*/
- if (!m_bUseSystemCPU)
- {
- // /Fixes PR 81522 (systemCPU version): if user says not to
- // use their CPU info, treat it as unknown per SMIL2 spec:
- bFailed = FALSE; // /Setting to FALSE instead of comparing to
- // "unknown" fixes CPU part of PR 64428(revisted)
- goto doneSysCPU;
- }
- // /The SMIL 2.0 draft of 12/2000 says:
- // "The following list contains the suggested values for this
- // test attribute (additional names may be supported by an
- // implementation): alpha, arm, arm32, hppa1.1, m68k, mips,
- // ppc, rs6000, vax, x86, unknown."
- switch (m_versionInfo.dwMachineType)
- {
- case HX_MACHINE_ALPHA:
- {
- if (0 != strcmp("alpha", pCPU))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_MACHINE_SYMEMULATOR:
- case HX_MACHINE_ARM:
- {
- if (0 != strcmp("arm", pCPU))
- {
- if (0 != strcmp("arm32", pCPU))
- {
- bFailed = TRUE;
- }
- }
- }
- break;
- /* /XXX- these aren't supported in HXGetWinVer():
- case :
- {
- if (0 != strcmp("hppa1.1", pCPU))
- {
- bFailed = TRUE;
- }
- }
- break;
- */
- case HX_MACHINE_68K:
- {
- if (0 != strcmp("m68k", pCPU))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_MACHINE_MIPS:
- {
- if (0 != strcmp("mips", pCPU))
- {
- bFailed = TRUE;
- }
- }
- break;
- case HX_MACHINE_PPC:
- {
- if (0 != strcmp("ppc", pCPU))
- {
- bFailed = TRUE;
- }
- }
- break;
- /* /XXX- this isn't supported in HXGetWinVer():
- case :
- {
- if (0 != strcmp("rs6000", pCPU))
- {
- bFailed = TRUE;
- }
- }
- break;
- */
- // /This one is not in the SMIL 2.0 spec; I added it as
- // permitted by the spec:
- case HX_MACHINE_SPARC:
- {
- if (0 != strcmp("sparc", pCPU))
- {
- bFailed = TRUE;
- }
- }
- break;
- /* /XXX- this isn't supported in HXGetWinVer():
- case :
- {
- if (0 != strcmp("vax", pCPU))
- {
- bFailed = TRUE;
- }
- }
- break;
- */
- case HX_MACHINE_486:
- case HX_MACHINE_586:
- case HX_MACHINE_686:
- {
- if (0 != strcmp("x86", pCPU))
- {
- bFailed = TRUE;
- }
- }
- break;
- default:
- {
- // /Need to fill in others here and in HXGetWinVer().
- }
- break;
- }
- if (bFailed && 0 == strcmp("unknown", pCPU))
- {
- bFailed = FALSE; // /"unknown should play on any CPU"
- }
- doneSysCPU:
- HX_RELEASE(pBuf);
- if(bFailed)
- {
- goto exit;
- }
- }
- if (m_pActiveNamespaceMap)
- {
- // look through name spaces for systemComponent name space. If it's there
- // append the prefix and look for systemComponent test attribute
- CHXMapStringToOb::Iterator ndxBuffer = m_pActiveNamespaceMap->Begin();
- for (; ndxBuffer != m_pActiveNamespaceMap->End(); ++ndxBuffer)
- {
- IHXBuffer* pBuffer = (IHXBuffer*)(*ndxBuffer);
- if (strcmp((const char*) SYSTEM_COMPONENT_NAMESPACE, (const char*)pBuffer->GetBuffer()) == 0)
- {
- const char* pPrefix = (const char*)ndxBuffer.get_key();
- // +1 for the : in the namespace and 1 for the