#101918# supporting -X option now
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: options.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: jsc $ $Date: 2001-03-13 12:04:21 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:29 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -131,9 +131,15 @@ public:
|
||||
|
||||
const StringVector& getInputFiles();
|
||||
|
||||
::rtl::OString getExtraInputFile(sal_uInt16 index) const throw( IllegalArgument );
|
||||
inline sal_uInt16 getNumberOfExtraInputFiles() const
|
||||
{ return (sal_uInt16)m_extra_input_files.size(); }
|
||||
inline const StringVector& getExtraInputFiles() const
|
||||
{ return m_extra_input_files; }
|
||||
protected:
|
||||
::rtl::OString m_program;
|
||||
StringVector m_inputFiles;
|
||||
StringVector m_extra_input_files;
|
||||
OptionMap m_options;
|
||||
};
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: typemanager.hxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: jsc $ $Date: 2001-03-13 12:04:21 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:29 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -121,17 +121,14 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual sal_Bool init(sal_Bool bMerge, const StringVector& regFiles)
|
||||
{ return sal_False; }
|
||||
virtual sal_Bool init(const ::rtl::OString& registryName)
|
||||
{ return sal_False; }
|
||||
|
||||
virtual sal_Bool isValidType(const ::rtl::OString& name)
|
||||
{ return sal_False; }
|
||||
|
||||
virtual RegistryKey getTypeKey(const ::rtl::OString& name)
|
||||
virtual RegistryKey getTypeKey(
|
||||
const ::rtl::OString& name, sal_Bool * pIsExtraType = 0 )
|
||||
{ return RegistryKey(); }
|
||||
virtual TypeReader getTypeReader(const ::rtl::OString& name)
|
||||
virtual TypeReader getTypeReader(
|
||||
const ::rtl::OString& name, sal_Bool * pIsExtraType = 0 )
|
||||
{ return TypeReader(); }
|
||||
virtual RTTypeClass getTypeClass(const ::rtl::OString& name)
|
||||
{ return RT_TYPE_INVALID; }
|
||||
@@ -153,16 +150,13 @@ protected:
|
||||
struct RegistryTypeManagerImpl
|
||||
{
|
||||
RegistryTypeManagerImpl()
|
||||
: m_pMergedRegistry(NULL)
|
||||
, m_isMerged(sal_False)
|
||||
, m_base("/")
|
||||
: m_base("/")
|
||||
{}
|
||||
|
||||
T2TypeClassMap m_t2TypeClass;
|
||||
RegistryList m_registries;
|
||||
Registry* m_pMergedRegistry;
|
||||
RegistryList m_extra_registries;
|
||||
::rtl::OString m_base;
|
||||
sal_Bool m_isMerged;
|
||||
};
|
||||
|
||||
class RegistryTypeManager : public TypeManager
|
||||
@@ -186,13 +180,15 @@ public:
|
||||
return *this;
|
||||
}
|
||||
*/
|
||||
sal_Bool init(sal_Bool bMerge, const StringVector& regFiles);
|
||||
sal_Bool init(const StringVector& regFiles, const StringVector& extraFiles = StringVector() );
|
||||
|
||||
sal_Bool isValidType(const ::rtl::OString& name)
|
||||
{ return searchTypeKey(name).isValid(); }
|
||||
RegistryKey getTypeKey(const ::rtl::OString& name)
|
||||
{ return searchTypeKey(name); }
|
||||
TypeReader getTypeReader(const ::rtl::OString& name);
|
||||
{ return searchTypeKey(name, 0).isValid(); }
|
||||
RegistryKey getTypeKey(
|
||||
const ::rtl::OString& name, sal_Bool * pIsExtraType = 0 )
|
||||
{ return searchTypeKey(name, pIsExtraType); }
|
||||
TypeReader getTypeReader(
|
||||
const ::rtl::OString& name, sal_Bool * pIsExtraType = 0 );
|
||||
RTTypeClass getTypeClass(const ::rtl::OString& name);
|
||||
|
||||
void setBase(const ::rtl::OString& base);
|
||||
@@ -200,7 +196,8 @@ public:
|
||||
|
||||
sal_Int32 getSize() { return m_pImpl->m_t2TypeClass.size(); }
|
||||
protected:
|
||||
RegistryKey searchTypeKey(const ::rtl::OString& name);
|
||||
RegistryKey searchTypeKey(
|
||||
const ::rtl::OString& name, sal_Bool * pIsExtraType = 0 );
|
||||
void freeRegistries();
|
||||
|
||||
void acquire();
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: options.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1.1.1 $
|
||||
* $Revision: 1.2 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2000-09-18 15:25:27 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:34 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -136,3 +136,17 @@ const StringVector& Options::getInputFiles()
|
||||
return m_inputFiles;
|
||||
}
|
||||
|
||||
OString Options::getExtraInputFile(sal_uInt16 index) const
|
||||
throw( IllegalArgument )
|
||||
{
|
||||
if (index < m_extra_input_files.size())
|
||||
{
|
||||
return m_extra_input_files[index];
|
||||
} else
|
||||
{
|
||||
throw IllegalArgument("index is out of bound.");
|
||||
}
|
||||
|
||||
return OString();
|
||||
}
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: typemanager.cxx,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:35 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -156,30 +156,17 @@ void RegistryTypeManager::acquire()
|
||||
void RegistryTypeManager::release()
|
||||
{
|
||||
if (0 == TypeManager::release())
|
||||
{
|
||||
if (m_pImpl->m_pMergedRegistry)
|
||||
{
|
||||
if (m_pImpl->m_pMergedRegistry->isValid())
|
||||
{
|
||||
m_pImpl->m_pMergedRegistry->destroy(OUString());
|
||||
}
|
||||
|
||||
delete m_pImpl->m_pMergedRegistry;
|
||||
}
|
||||
|
||||
if (m_pImpl->m_registries.size() > 0)
|
||||
{
|
||||
freeRegistries();
|
||||
}
|
||||
|
||||
delete m_pImpl;
|
||||
}
|
||||
}
|
||||
|
||||
sal_Bool RegistryTypeManager::init(sal_Bool bMerged, const StringVector& regFiles)
|
||||
sal_Bool RegistryTypeManager::init(
|
||||
const StringVector& regFiles,
|
||||
StringVector const & extraFiles )
|
||||
{
|
||||
m_pImpl->m_isMerged = bMerged && (regFiles.size() > 1);
|
||||
|
||||
if (regFiles.empty())
|
||||
return sal_False;
|
||||
|
||||
@@ -198,53 +185,27 @@ sal_Bool RegistryTypeManager::init(sal_Bool bMerged, const StringVector& regFile
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (m_pImpl->m_isMerged)
|
||||
iter = extraFiles.begin();
|
||||
while (iter != extraFiles.end())
|
||||
{
|
||||
Registry *pTmpReg = new Registry(loader);
|
||||
OString tmpName(makeTempName(NULL));
|
||||
|
||||
if (!pTmpReg->create( convertToFileUrl(tmpName) ) )
|
||||
if (!tmpReg.open( convertToFileUrl(*iter), REG_READONLY))
|
||||
m_pImpl->m_extra_registries.push_back(new Registry(tmpReg));
|
||||
else
|
||||
{
|
||||
RegistryKey rootKey;
|
||||
RegError ret = REG_NO_ERROR;
|
||||
OUString aRoot( RTL_CONSTASCII_USTRINGPARAM("/") );
|
||||
iter = regFiles.begin();
|
||||
pTmpReg->openRootKey(rootKey);
|
||||
|
||||
while (iter != regFiles.end())
|
||||
{
|
||||
if ( ret = pTmpReg->mergeKey(rootKey, aRoot, convertToFileUrl( *iter )) )
|
||||
{
|
||||
if (ret != REG_MERGE_CONFLICT)
|
||||
{
|
||||
freeRegistries();
|
||||
rootKey.closeKey();
|
||||
pTmpReg->destroy( OUString() );
|
||||
delete pTmpReg;
|
||||
return sal_False;
|
||||
}
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
||||
m_pImpl->m_pMergedRegistry = pTmpReg;
|
||||
freeRegistries();
|
||||
} else
|
||||
{
|
||||
delete pTmpReg;
|
||||
freeRegistries();
|
||||
return sal_False;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
|
||||
return sal_True;
|
||||
}
|
||||
|
||||
TypeReader RegistryTypeManager::getTypeReader(const OString& name)
|
||||
TypeReader RegistryTypeManager::getTypeReader(
|
||||
const OString& name, sal_Bool * pIsExtraType )
|
||||
{
|
||||
TypeReader reader;
|
||||
RegistryKey key(searchTypeKey(name));
|
||||
RegistryKey key(searchTypeKey(name, pIsExtraType));
|
||||
|
||||
if (key.isValid())
|
||||
{
|
||||
@@ -317,38 +278,51 @@ void RegistryTypeManager::setBase(const OString& base)
|
||||
void RegistryTypeManager::freeRegistries()
|
||||
{
|
||||
RegistryList::const_iterator iter = m_pImpl->m_registries.begin();
|
||||
|
||||
while (iter != m_pImpl->m_registries.end())
|
||||
{
|
||||
delete *iter;
|
||||
++iter;
|
||||
}
|
||||
|
||||
iter = m_pImpl->m_extra_registries.begin();
|
||||
while (iter != m_pImpl->m_extra_registries.end())
|
||||
{
|
||||
delete *iter;
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
RegistryKey RegistryTypeManager::searchTypeKey(const OString& name)
|
||||
RegistryKey RegistryTypeManager::searchTypeKey(const OString& name_, sal_Bool * pIsExtraType )
|
||||
{
|
||||
OUString name( OStringToOUString(m_pImpl->m_base + name_, RTL_TEXTENCODING_UTF8) );
|
||||
RegistryKey key, rootKey;
|
||||
|
||||
if (m_pImpl->m_isMerged)
|
||||
{
|
||||
if (!m_pImpl->m_pMergedRegistry->openRootKey(rootKey))
|
||||
{
|
||||
rootKey.openKey(OStringToOUString(m_pImpl->m_base + name, RTL_TEXTENCODING_UTF8), key);
|
||||
}
|
||||
} else
|
||||
{
|
||||
RegistryList::const_iterator iter = m_pImpl->m_registries.begin();
|
||||
|
||||
while (iter != m_pImpl->m_registries.end())
|
||||
{
|
||||
if (!(*iter)->openRootKey(rootKey))
|
||||
{
|
||||
if (!rootKey.openKey(OStringToOUString(m_pImpl->m_base + name, RTL_TEXTENCODING_UTF8), key))
|
||||
break;
|
||||
if (!rootKey.openKey(name, key))
|
||||
{
|
||||
if (pIsExtraType)
|
||||
*pIsExtraType = sal_False;
|
||||
return key;
|
||||
}
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
iter = m_pImpl->m_extra_registries.begin();
|
||||
while (iter != m_pImpl->m_extra_registries.end())
|
||||
{
|
||||
if (!(*iter)->openRootKey(rootKey))
|
||||
{
|
||||
if (!rootKey.openKey(name, key))
|
||||
{
|
||||
if (pIsExtraType)
|
||||
*pIsExtraType = sal_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
|
||||
return key;
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cppumaker.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: pl $ $Date: 2001-05-10 14:16:40 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:37 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -142,7 +142,7 @@ int _cdecl main( int argc, char * argv[] )
|
||||
RegistryTypeManager typeMgr;
|
||||
TypeDependency typeDependencies;
|
||||
|
||||
if (!typeMgr.init(!options.isValid("-T"), options.getInputFiles()))
|
||||
if (!typeMgr.init(options.getInputFiles(), options.getExtraInputFiles()))
|
||||
{
|
||||
fprintf(stderr, "%s : init registries failed, check your registry files.\n", options.getProgramName().getStr());
|
||||
exit(99);
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cppuoptions.cxx,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2002-02-21 11:35:11 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:38 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -265,6 +265,34 @@ sal_Bool CppuOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile)
|
||||
|
||||
m_options["-G"] = OString("");
|
||||
break;
|
||||
|
||||
case 'X': // support for eXtra type rdbs
|
||||
{
|
||||
if (av[i][2] == '\0')
|
||||
{
|
||||
if (i < ac - 1 && av[i+1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
s = av[i];
|
||||
} else
|
||||
{
|
||||
OString tmp("'-X', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i+1]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
} else
|
||||
{
|
||||
s = av[i] + 2;
|
||||
}
|
||||
|
||||
m_extra_input_files.push_back( s );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw IllegalArgument("the option is unknown" + OString(av[i]));
|
||||
break;
|
||||
@@ -324,6 +352,7 @@ OString CppuOptions::prepareHelp()
|
||||
help += " -C = getCppuType function keeps comprehensive type information.\n";
|
||||
help += " -G = generate only target files which does not exists.\n";
|
||||
help += " -Gc = generate only target files which content will be changed.\n";
|
||||
help += " -X<file> = extra types which will not be taken into account for generation.\n";
|
||||
help += prepareVersion();
|
||||
|
||||
return help;
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cpputype.cxx,v $
|
||||
*
|
||||
* $Revision: 1.19 $
|
||||
* $Revision: 1.20 $
|
||||
*
|
||||
* last change: $Author: jsc $ $Date: 2002-06-18 17:26:56 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:38 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -3972,7 +3972,13 @@ sal_Bool produceType(const OString& typeName,
|
||||
if (typeDependencies.isGenerated(typeName))
|
||||
return sal_True;
|
||||
|
||||
TypeReader reader(typeMgr.getTypeReader(typeName));
|
||||
sal_Bool bIsExtraType = sal_False;
|
||||
TypeReader reader(typeMgr.getTypeReader(typeName, &bIsExtraType));
|
||||
if (bIsExtraType)
|
||||
{
|
||||
typeDependencies.setGenerated(typeName);
|
||||
return sal_True;
|
||||
}
|
||||
|
||||
if (!reader.isValid())
|
||||
{
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: javamaker.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: pl $ $Date: 2001-05-10 14:16:41 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:42 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -142,7 +142,7 @@ int _cdecl main( int argc, char * argv[] )
|
||||
RegistryTypeManager typeMgr;
|
||||
TypeDependency typeDependencies;
|
||||
|
||||
if (!typeMgr.init(!options.isValid("-T"), options.getInputFiles()))
|
||||
if (!typeMgr.init(options.getInputFiles(), options.getExtraInputFiles()))
|
||||
{
|
||||
fprintf(stderr, "%s : init registries failed, check your registry files.\n", options.getProgramName().getStr());
|
||||
exit(99);
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: javaoptions.cxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2002-02-21 11:41:39 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:43 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -186,6 +186,34 @@ sal_Bool JavaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile)
|
||||
m_options["-T"] = OString(s);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'X': // support for eXtra type rdbs
|
||||
{
|
||||
if (av[i][2] == '\0')
|
||||
{
|
||||
if (i < ac - 1 && av[i+1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
s = av[i];
|
||||
} else
|
||||
{
|
||||
OString tmp("'-X', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i+1]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
} else
|
||||
{
|
||||
s = av[i] + 2;
|
||||
}
|
||||
|
||||
m_extra_input_files.push_back( s );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw IllegalArgument("the option is unknown" + OString(av[i]));
|
||||
break;
|
||||
@@ -232,7 +260,7 @@ sal_Bool JavaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile)
|
||||
OString JavaOptions::prepareHelp()
|
||||
{
|
||||
OString help("\nusing: ");
|
||||
help += m_program + " [-options] file_1 ... file_n\nOptions:\n";
|
||||
help += m_program + " [-options] file_1 ... file_n -Xfile_n+1 -Xfile_n+2\nOptions:\n";
|
||||
help += " -O<path> = path describes the root directory for the generated output.\n";
|
||||
help += " The output directory tree is generated under this directory.\n";
|
||||
help += " -T<name> = name specifies a type or a list of types. The output for this\n";
|
||||
@@ -242,6 +270,7 @@ OString JavaOptions::prepareHelp()
|
||||
help += " -B<name> = name specifies the base node. All types are searched under this\n";
|
||||
help += " node. Default is the root '/' of the registry files.\n";
|
||||
help += " -nD = no dependent types are generated.\n";
|
||||
help += " -X<file> = extra types which will not be taken into account for generation.\n";
|
||||
help += prepareVersion();
|
||||
|
||||
return help;
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: javatype.cxx,v $
|
||||
*
|
||||
* $Revision: 1.15 $
|
||||
* $Revision: 1.16 $
|
||||
*
|
||||
* last change: $Author: jsc $ $Date: 2002-06-25 08:56:49 $
|
||||
* last change: $Author: dbo $ $Date: 2002-07-31 12:46:45 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -1895,7 +1895,33 @@ sal_Bool produceType(const OString& typeName,
|
||||
if (typeDependencies.isGenerated(typeName))
|
||||
return sal_True;
|
||||
|
||||
RegistryKey typeKey = typeMgr.getTypeKey(typeName);
|
||||
sal_Bool bIsExtraType = sal_False;
|
||||
TypeReader reader(typeMgr.getTypeReader(typeName, &bIsExtraType));
|
||||
if (bIsExtraType)
|
||||
{
|
||||
typeDependencies.setGenerated(typeName);
|
||||
return sal_True;
|
||||
}
|
||||
|
||||
if (!reader.isValid())
|
||||
{
|
||||
if (typeName.equals("/"))
|
||||
return sal_True;
|
||||
else
|
||||
return sal_False;
|
||||
}
|
||||
|
||||
if( !checkTypeDependencies(typeMgr, typeDependencies, typeName))
|
||||
return sal_False;
|
||||
|
||||
/*
|
||||
sal_Bool bIsExtraType = sal_False;
|
||||
RegistryKey typeKey = typeMgr.getTypeKey(typeName, &bIsExtraType);
|
||||
if (bIsExtraType)
|
||||
{
|
||||
typeDependencies.setGenerated(typeName);
|
||||
return sal_True;
|
||||
}
|
||||
|
||||
if (!typeKey.isValid())
|
||||
return sal_False;
|
||||
@@ -1926,7 +1952,7 @@ sal_Bool produceType(const OString& typeName,
|
||||
TypeReader reader(rReaderLoader, pBuffer, valueSize, sal_True);
|
||||
|
||||
rtl_freeMemory(pBuffer);
|
||||
|
||||
*/
|
||||
RTTypeClass typeClass = reader.getTypeClass();
|
||||
sal_Bool ret = sal_False;
|
||||
switch (typeClass)
|
||||
|
Reference in New Issue
Block a user