remove unused dirs
This commit is contained in:
parent
a6b72e9d88
commit
7a042510db
@ -1,188 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
// MARKER(update_precomp.py): autogen include statement, do not remove
|
||||
#include "precompiled_codemaker.hxx"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sal/main.h"
|
||||
|
||||
#include <codemaker/typemanager.hxx>
|
||||
#include <codemaker/dependency.hxx>
|
||||
|
||||
#include "cunooptions.hxx"
|
||||
#include "cunotype.hxx"
|
||||
|
||||
using namespace rtl;
|
||||
|
||||
sal_Bool produceAllTypes(const OString& typeName,
|
||||
TypeManager& typeMgr,
|
||||
TypeDependency& typeDependencies,
|
||||
CunoOptions* pOptions,
|
||||
sal_Bool bFullScope)
|
||||
throw( CannotDumpException )
|
||||
{
|
||||
if (!produceType(typeName, typeMgr, typeDependencies, pOptions))
|
||||
{
|
||||
fprintf(stderr, "%s ERROR: %s\n",
|
||||
pOptions->getProgramName().getStr(),
|
||||
OString("cannot dump Type '" + typeName + "'").getStr());
|
||||
exit(99);
|
||||
}
|
||||
|
||||
RegistryKey typeKey = typeMgr.getTypeKey(typeName);
|
||||
RegistryKeyNames subKeys;
|
||||
|
||||
if (typeKey.getKeyNames(OUString(), subKeys))
|
||||
return sal_False;
|
||||
|
||||
OString tmpName;
|
||||
for (sal_uInt32 i=0; i < subKeys.getLength(); i++)
|
||||
{
|
||||
tmpName = OUStringToOString(subKeys.getElement(i), RTL_TEXTENCODING_UTF8);
|
||||
|
||||
if (pOptions->isValid("-B"))
|
||||
tmpName = tmpName.copy(tmpName.indexOf('/', 1) + 1);
|
||||
else
|
||||
tmpName = tmpName.copy(1);
|
||||
|
||||
if (bFullScope)
|
||||
{
|
||||
if (!produceAllTypes(tmpName, typeMgr, typeDependencies, pOptions, sal_True))
|
||||
return sal_False;
|
||||
} else
|
||||
{
|
||||
if (!produceType(tmpName, typeMgr, typeDependencies, pOptions))
|
||||
return sal_False;
|
||||
}
|
||||
}
|
||||
|
||||
return sal_True;
|
||||
}
|
||||
|
||||
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
|
||||
{
|
||||
CunoOptions options;
|
||||
|
||||
try
|
||||
{
|
||||
if (!options.initOptions(argc, argv))
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
catch( IllegalArgument& e)
|
||||
{
|
||||
fprintf(stderr, "Illegal option: %s\n", e.m_message.getStr());
|
||||
exit(99);
|
||||
}
|
||||
|
||||
RegistryTypeManager typeMgr;
|
||||
TypeDependency typeDependencies;
|
||||
|
||||
if (!typeMgr.init(!options.isValid("-T"), options.getInputFiles()))
|
||||
{
|
||||
fprintf(stderr, "%s : init registries failed, check your registry files.\n", options.getProgramName().getStr());
|
||||
exit(99);
|
||||
}
|
||||
|
||||
if (options.isValid("-B"))
|
||||
{
|
||||
typeMgr.setBase(options.getOption("-B"));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (options.isValid("-T"))
|
||||
{
|
||||
OString tOption(options.getOption("-T"));
|
||||
|
||||
OString typeName, tmpName;
|
||||
sal_Bool ret = sal_False;
|
||||
sal_Int32 nIndex = 0;
|
||||
do
|
||||
{
|
||||
typeName = tOption.getToken(0, ';', nIndex);
|
||||
|
||||
sal_Int32 nPos = typeName.lastIndexOf( '.' );
|
||||
tmpName = typeName.copy( nPos != -1 ? nPos+1 : 0 );
|
||||
if (tmpName == "*")
|
||||
{
|
||||
// produce this type and his scope, but the scope is not recursively generated.
|
||||
if (typeName.equals("*"))
|
||||
{
|
||||
tmpName = "/";
|
||||
} else
|
||||
{
|
||||
tmpName = typeName.copy(0, typeName.lastIndexOf('.')).replace('.', '/');
|
||||
if (tmpName.getLength() == 0)
|
||||
tmpName = "/";
|
||||
else
|
||||
tmpName.replace('.', '/');
|
||||
}
|
||||
ret = produceAllTypes(tmpName, typeMgr, typeDependencies, &options, sal_False);
|
||||
} else
|
||||
{
|
||||
// produce only this type
|
||||
ret = produceType(typeName.replace('.', '/'), typeMgr, typeDependencies, &options);
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
fprintf(stderr, "%s ERROR: %s\n",
|
||||
options.getProgramName().getStr(),
|
||||
OString("cannot dump Type '" + typeName + "'").getStr());
|
||||
exit(99);
|
||||
}
|
||||
} while( nIndex != -1 );
|
||||
} else
|
||||
{
|
||||
// produce all types
|
||||
if (!produceAllTypes("/", typeMgr, typeDependencies, &options, sal_True))
|
||||
{
|
||||
fprintf(stderr, "%s ERROR: %s\n",
|
||||
options.getProgramName().getStr(),
|
||||
"an error occurs while dumping all types.");
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( CannotDumpException& e)
|
||||
{
|
||||
fprintf(stderr, "%s ERROR: %s\n",
|
||||
options.getProgramName().getStr(),
|
||||
e.m_message.getStr());
|
||||
exit(99);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -1,333 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
// MARKER(update_precomp.py): autogen include statement, do not remove
|
||||
#include "precompiled_codemaker.hxx"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cunooptions.hxx"
|
||||
|
||||
using namespace rtl;
|
||||
|
||||
sal_Bool CunoOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile)
|
||||
throw( IllegalArgument )
|
||||
{
|
||||
sal_Bool ret = sal_True;
|
||||
sal_uInt16 i=0;
|
||||
|
||||
if (!bCmdFile)
|
||||
{
|
||||
bCmdFile = sal_True;
|
||||
|
||||
m_program = av[0];
|
||||
|
||||
if (ac < 2)
|
||||
{
|
||||
fprintf(stderr, "%s", prepareHelp().getStr());
|
||||
ret = sal_False;
|
||||
}
|
||||
|
||||
i = 1;
|
||||
} else
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
char *s=NULL;
|
||||
for (i; i < ac; i++)
|
||||
{
|
||||
if (av[i][0] == '-')
|
||||
{
|
||||
switch (av[i][1])
|
||||
{
|
||||
case 'O':
|
||||
if (av[i][2] == 'C')
|
||||
{
|
||||
if (av[i][3] == '\0')
|
||||
{
|
||||
if (i < ac - 1 && av[i+1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
s = av[i];
|
||||
} else
|
||||
{
|
||||
OString tmp("'-OC', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i+1]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
} else
|
||||
{
|
||||
s = av[i] + 3;
|
||||
}
|
||||
|
||||
m_options["-OC"] = OString(s);
|
||||
break;
|
||||
} else
|
||||
if (av[i][2] == '\0')
|
||||
{
|
||||
if (i < ac - 1 && av[i+1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
s = av[i];
|
||||
} else
|
||||
{
|
||||
OString tmp("'-O', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i+1]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
} else
|
||||
{
|
||||
s = av[i] + 2;
|
||||
}
|
||||
|
||||
m_options["-O"] = OString(s);
|
||||
break;
|
||||
case 'B':
|
||||
if (av[i][2] == '\0')
|
||||
{
|
||||
if (i < ac - 1 && av[i+1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
s = av[i];
|
||||
} else
|
||||
{
|
||||
OString tmp("'-B', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i+1]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
} else
|
||||
{
|
||||
s = av[i] + 2;
|
||||
}
|
||||
|
||||
m_options["-B"] = OString(s);
|
||||
break;
|
||||
case 'T':
|
||||
if (av[i][2] == '\0')
|
||||
{
|
||||
if (i < ac - 1 && av[i+1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
s = av[i];
|
||||
} else
|
||||
{
|
||||
OString tmp("'-T', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i+1]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
} else
|
||||
{
|
||||
s = av[i] + 2;
|
||||
}
|
||||
|
||||
if (m_options.count("-T") > 0)
|
||||
{
|
||||
OString tmp(m_options["-T"]);
|
||||
tmp = tmp + ";" + s;
|
||||
m_options["-T"] = tmp;
|
||||
} else
|
||||
{
|
||||
m_options["-T"] = OString(s);
|
||||
}
|
||||
break;
|
||||
case 'U':
|
||||
if (av[i][2] != '\0')
|
||||
{
|
||||
OString tmp("'-U', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
|
||||
m_options["-U"] = OString("");
|
||||
break;
|
||||
/*
|
||||
case 'L':
|
||||
if (av[i][2] != '\0')
|
||||
{
|
||||
OString tmp("'-L', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
|
||||
if (isValid("-C") || isValid("-CS"))
|
||||
{
|
||||
OString tmp("'-L' could not be combined with '-C' or '-CS' option");
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
m_options["-L"] = OString("");
|
||||
break;
|
||||
*/
|
||||
case 'C':
|
||||
if (av[i][2] != '\0')
|
||||
{
|
||||
OString tmp("'-C', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
|
||||
if (isValid("-L") || isValid("-CS"))
|
||||
{
|
||||
OString tmp("'-C' could not be combined with '-L' or '-CS' option");
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
m_options["-C"] = OString("");
|
||||
break;
|
||||
case 'G':
|
||||
if (av[i][2] == 'c')
|
||||
{
|
||||
if (av[i][3] != '\0')
|
||||
{
|
||||
OString tmp("'-Gc', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
|
||||
m_options["-Gc"] = OString("");
|
||||
break;
|
||||
} else
|
||||
if (av[i][2] != '\0')
|
||||
{
|
||||
OString tmp("'-G', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
|
||||
m_options["-G"] = OString("");
|
||||
break;
|
||||
default:
|
||||
throw IllegalArgument("the option is unknown" + OString(av[i]));
|
||||
break;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (av[i][0] == '@')
|
||||
{
|
||||
FILE* cmdFile = fopen(av[i]+1, "r");
|
||||
if( cmdFile == NULL )
|
||||
{
|
||||
fprintf(stderr, "%s", prepareHelp().getStr());
|
||||
ret = sal_False;
|
||||
} else
|
||||
{
|
||||
int rargc=0;
|
||||
char* rargv[512];
|
||||
char buffer[512];
|
||||
|
||||
while ( fscanf(cmdFile, "%s", buffer) != EOF )
|
||||
{
|
||||
rargv[rargc]= strdup(buffer);
|
||||
rargc++;
|
||||
}
|
||||
fclose(cmdFile);
|
||||
|
||||
ret = initOptions(rargc, rargv, bCmdFile);
|
||||
|
||||
for (long i=0; i < rargc; i++)
|
||||
{
|
||||
free(rargv[i]);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
m_inputFiles.push_back(av[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
OString CunoOptions::prepareHelp()
|
||||
{
|
||||
OString help("\nusing: ");
|
||||
help += m_program + " [-options] file_1 ... file_n\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";
|
||||
help += " [t1;...] type is generated. If no '-T' option is specified,\n";
|
||||
help += " then output for all types is generated.\n";
|
||||
help += " Example: 'com.sun.star.uno.XInterface' is a valid type.\n";
|
||||
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 += " -U = activate the generating of a getCppuType_<name> function.\n";
|
||||
// help += " -L = getCppuType function with a known leak.\n";
|
||||
help += " -C = getCppuType_<name> 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 += prepareVersion();
|
||||
|
||||
return help;
|
||||
}
|
||||
|
||||
OString CunoOptions::prepareVersion()
|
||||
{
|
||||
OString version("\nSun Microsystems (R) ");
|
||||
version += m_program + " Version 1.0\n\n";
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef INCLUDED_CODEMAKER_SOURCE_CUNOMAKER_CUNOOPTIONS_HXX
|
||||
#define INCLUDED_CODEMAKER_SOURCE_CUNOMAKER_CUNOOPTIONS_HXX
|
||||
|
||||
#include <codemaker/options.hxx>
|
||||
|
||||
class CunoOptions : public Options
|
||||
{
|
||||
public:
|
||||
CunoOptions()
|
||||
: Options() {}
|
||||
|
||||
~CunoOptions() {}
|
||||
|
||||
sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False)
|
||||
throw( IllegalArgument );
|
||||
|
||||
::rtl::OString prepareHelp();
|
||||
|
||||
::rtl::OString prepareVersion();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // INCLUDED_CODEMAKER_SOURCE_CUNOMAKER_CUNOOPTIONS_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
File diff suppressed because it is too large
Load Diff
@ -1,311 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef INCLUDED_CODEMAKER_SOURCE_CUNOMAKER_CUNOTYPE_HXX_
|
||||
#define INCLUDED_CODEMAKER_SOURCE_CUNOMAKER_CUNOTYPE_HXX
|
||||
|
||||
#include <codemaker/typemanager.hxx>
|
||||
#include <codemaker/dependency.hxx>
|
||||
|
||||
enum BASETYPE
|
||||
{
|
||||
BT_INVALID,
|
||||
BT_VOID,
|
||||
BT_ANY,
|
||||
BT_TYPE,
|
||||
BT_BOOLEAN,
|
||||
BT_CHAR,
|
||||
BT_STRING,
|
||||
BT_FLOAT,
|
||||
BT_DOUBLE,
|
||||
BT_OCTET,
|
||||
BT_BYTE,
|
||||
BT_SHORT,
|
||||
BT_LONG,
|
||||
BT_HYPER,
|
||||
BT_UNSIGNED_SHORT,
|
||||
BT_UNSIGNED_LONG,
|
||||
BT_UNSIGNED_HYPER
|
||||
};
|
||||
|
||||
|
||||
enum CunoTypeDecl
|
||||
{
|
||||
CUNOTYPEDECL_ALLTYPES,
|
||||
CUNOTYPEDECL_NOINTERFACES,
|
||||
CUNOTYPEDECL_ONLYINTERFACES
|
||||
};
|
||||
|
||||
class CunoOptions;
|
||||
class FileStream;
|
||||
|
||||
class CunoType
|
||||
{
|
||||
public:
|
||||
CunoType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~CunoType();
|
||||
|
||||
virtual sal_Bool dump(CunoOptions* pOptions) throw( CannotDumpException );
|
||||
virtual sal_Bool dumpDependedTypes(CunoOptions* pOptions) throw( CannotDumpException );
|
||||
virtual sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException ) = 0;
|
||||
virtual sal_Bool dumpCFile(FileStream& o) throw( CannotDumpException ) = 0;
|
||||
|
||||
virtual ::rtl::OString dumpHeaderDefine(FileStream& o, sal_Char* prefix, sal_Bool bExtended=sal_False);
|
||||
virtual void dumpDefaultHIncludes(FileStream& o);
|
||||
virtual void dumpDefaultCIncludes(FileStream& o);
|
||||
virtual void dumpInclude(FileStream& o, const ::rtl::OString& typeName, sal_Char* prefix, sal_Bool bExtended=sal_False, sal_Bool bCaseSensitive=sal_False);
|
||||
virtual void dumpDepIncludes(FileStream& o, const ::rtl::OString& typeName, sal_Char* prefix);
|
||||
|
||||
virtual void dumpOpenExternC(FileStream& o);
|
||||
virtual void dumpCloseExternC(FileStream& o);
|
||||
|
||||
virtual void dumpGetCunoType(FileStream& o);
|
||||
virtual void dumpCGetCunoType(FileStream& o);
|
||||
virtual void dumpLGetCunoType(FileStream& o);
|
||||
|
||||
virtual void dumpType(FileStream& o, const ::rtl::OString& type, sal_Bool bConst=sal_False,
|
||||
sal_Bool bPointer=sal_False, sal_Bool bParam=sal_False)
|
||||
throw( CannotDumpException );
|
||||
::rtl::OString getTypeClass(const ::rtl::OString& type="", sal_Bool bCStyle=sal_False);
|
||||
::rtl::OString getBaseType(const ::rtl::OString& type);
|
||||
void dumpCppuGetType(FileStream& o, const ::rtl::OString& type, sal_Bool bDecl=sal_False, CunoTypeDecl eDeclFlag=CUNOTYPEDECL_ALLTYPES);
|
||||
void dumpTypeInit(FileStream& o, const ::rtl::OString& type);
|
||||
BASETYPE isBaseType(const ::rtl::OString& type);
|
||||
|
||||
::rtl::OString typeToIdentifier(const ::rtl::OString& type);
|
||||
|
||||
void dumpConstantValue(FileStream& o, sal_uInt16 index);
|
||||
|
||||
virtual sal_uInt32 getMemberCount();
|
||||
virtual sal_uInt32 getInheritedMemberCount();
|
||||
void dumpInheritedMembers(FileStream& o, rtl::OString& superType);
|
||||
|
||||
sal_Bool isSeqType(const ::rtl::OString& type, ::rtl::OString& baseType, ::rtl::OString& seqPrefix);
|
||||
sal_Bool isArrayType(const ::rtl::OString& type, ::rtl::OString& baseType, ::rtl::OString& arrayPrefix);
|
||||
sal_Bool isVoid(const ::rtl::OString& type)
|
||||
{ return type.equals("void"); }
|
||||
void inc(sal_uInt32 num=4);
|
||||
void dec(sal_uInt32 num=4);
|
||||
::rtl::OString indent();
|
||||
::rtl::OString indent(sal_uInt32 num);
|
||||
protected:
|
||||
virtual sal_uInt32 checkInheritedMemberCount(const TypeReader* pReader);
|
||||
|
||||
::rtl::OString checkSpecialCunoType(const ::rtl::OString& type);
|
||||
::rtl::OString checkRealBaseType(const ::rtl::OString& type, sal_Bool bResolveTypeOnly = sal_False);
|
||||
void dumpCppuGetTypeMemberDecl(FileStream& o, CunoTypeDecl eDeclFlag);
|
||||
|
||||
sal_Bool isNestedType() const
|
||||
{ return m_bIsNestedType; };
|
||||
|
||||
RegistryKeyNames& getNestedTypeNames()
|
||||
{ return m_nestedTypeNames; };
|
||||
|
||||
sal_Bool isNestedTypeByName(const ::rtl::OString& type);
|
||||
sal_Bool hasNestedType(const ::rtl::OString& type);
|
||||
|
||||
protected:
|
||||
sal_uInt32 m_inheritedMemberCount;
|
||||
|
||||
sal_Bool m_cunoTypeLib;
|
||||
sal_Bool m_cunoTypeLeak;
|
||||
sal_Bool m_cunoTypeDynamic;
|
||||
sal_uInt32 m_indentLength;
|
||||
::rtl::OString m_typeName;
|
||||
::rtl::OString m_name;
|
||||
TypeReader m_reader;
|
||||
TypeManager& m_typeMgr;
|
||||
TypeDependency m_dependencies;
|
||||
sal_Bool m_bIsNestedType;
|
||||
RegistryKeyNames m_nestedTypeNames;
|
||||
};
|
||||
|
||||
class InterfaceType : public CunoType
|
||||
{
|
||||
public:
|
||||
InterfaceType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~InterfaceType();
|
||||
|
||||
sal_Bool dumpDeclaration(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpCFile(FileStream& o) throw( CannotDumpException );
|
||||
|
||||
void dumpInheritedFunctions(FileStream& o, rtl::OString& superType);
|
||||
void dumpAttributes(FileStream& o, const ::rtl::OString& interfaceType, TypeReader& reader );
|
||||
void dumpMethods(FileStream& o, const ::rtl::OString& interfaceType, TypeReader& reader );
|
||||
void dumpGetCunoType(FileStream& o);
|
||||
void dumpCGetCunoType(FileStream& o);
|
||||
void dumpCUnoAttributeTypeNames(FileStream& o, sal_Bool bRelease=sal_False);
|
||||
void dumpCUnoMethodTypeNames(FileStream& o, sal_Bool bRelease=sal_False);
|
||||
void dumpCUnoAttributeRefs(FileStream& o, sal_uInt32& index);
|
||||
void dumpCUnoMethodRefs(FileStream& o, sal_uInt32& index);
|
||||
void dumpCUnoAttributes(FileStream& o, sal_uInt32& index);
|
||||
void dumpCUnoMethods(FileStream& o, sal_uInt32& index);
|
||||
void dumpAttributesCppuDecl(FileStream& o, StringSet* pFinishedTypes, CunoTypeDecl eDeclFlag);
|
||||
void dumpMethodsCppuDecl(FileStream& o, StringSet* pFinishedTypes, CunoTypeDecl eDeclFlag );
|
||||
|
||||
sal_uInt32 getMemberCount();
|
||||
sal_uInt32 getInheritedMemberCount();
|
||||
|
||||
protected:
|
||||
sal_uInt32 checkInheritedMemberCount(const TypeReader* pReader);
|
||||
|
||||
protected:
|
||||
sal_uInt32 m_inheritedMemberCount;
|
||||
sal_Bool m_hasAttributes;
|
||||
sal_Bool m_hasMethods;
|
||||
};
|
||||
|
||||
class ModuleType : public CunoType
|
||||
{
|
||||
public:
|
||||
ModuleType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~ModuleType();
|
||||
|
||||
virtual sal_Bool dump(CunoOptions* pOptions) throw( CannotDumpException );
|
||||
|
||||
sal_Bool dumpDeclaration(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpCFile(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool hasConstants();
|
||||
};
|
||||
|
||||
class ConstantsType : public ModuleType
|
||||
{
|
||||
public:
|
||||
ConstantsType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~ConstantsType();
|
||||
|
||||
virtual sal_Bool dump(CunoOptions* pOptions) throw( CannotDumpException );
|
||||
};
|
||||
|
||||
class StructureType : public CunoType
|
||||
{
|
||||
public:
|
||||
StructureType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~StructureType();
|
||||
|
||||
sal_Bool dumpDeclaration(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpCFile(FileStream& o) throw( CannotDumpException );
|
||||
};
|
||||
|
||||
class ExceptionType : public CunoType
|
||||
{
|
||||
public:
|
||||
ExceptionType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~ExceptionType();
|
||||
|
||||
sal_Bool dumpDeclaration(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpCFile(FileStream& o) throw( CannotDumpException );
|
||||
};
|
||||
|
||||
class EnumType : public CunoType
|
||||
{
|
||||
public:
|
||||
EnumType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~EnumType();
|
||||
|
||||
sal_Bool dumpDeclaration(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpCFile(FileStream& o) throw( CannotDumpException );
|
||||
|
||||
void dumpGetCunoType(FileStream& o);
|
||||
void dumpCGetCunoType(FileStream& o);
|
||||
};
|
||||
|
||||
class TypeDefType : public CunoType
|
||||
{
|
||||
public:
|
||||
TypeDefType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~TypeDefType();
|
||||
|
||||
sal_Bool dumpDeclaration(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool dumpCFile(FileStream& o) throw( CannotDumpException );
|
||||
|
||||
void dumpGetCunoType(FileStream& o);
|
||||
void dumpLGetCunoType(FileStream& o);
|
||||
void dumpCGetCunoType(FileStream& o);
|
||||
};
|
||||
|
||||
|
||||
sal_Bool produceType(const ::rtl::OString& typeName,
|
||||
TypeManager& typeMgr,
|
||||
TypeDependency& typeDependencies,
|
||||
CunoOptions* pOptions)
|
||||
throw( CannotDumpException );
|
||||
|
||||
/**
|
||||
* This function returns a C++ scoped name, represents the namespace
|
||||
* scoping of this type, e.g. com:.sun::star::uno::XInterface. If the scope of
|
||||
* the type is equal scope, the relativ name will be used.
|
||||
*/
|
||||
::rtl::OString scopedName(const ::rtl::OString& scope, const ::rtl::OString& type,
|
||||
sal_Bool bNoNameSpace=sal_False);
|
||||
|
||||
::rtl::OString shortScopedName(const ::rtl::OString& scope, const ::rtl::OString& type,
|
||||
sal_Bool bNoNameSpace=sal_False);
|
||||
|
||||
|
||||
#endif // INCLUDED_CODEMAKER_SOURCE_CUNOMAKER_CUNOTYPE_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -1,61 +0,0 @@
|
||||
#*************************************************************************
|
||||
#
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
#
|
||||
# OpenOffice.org - a multi-platform office productivity suite
|
||||
#
|
||||
# This file is part of OpenOffice.org.
|
||||
#
|
||||
# OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License version 3
|
||||
# only, as published by the Free Software Foundation.
|
||||
#
|
||||
# OpenOffice.org is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License version 3 for more details
|
||||
# (a copy is included in the LICENSE file that accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# version 3 along with OpenOffice.org. If not, see
|
||||
# <http://www.openoffice.org/license.html>
|
||||
# for a copy of the LGPLv3 License.
|
||||
#
|
||||
#*************************************************************************
|
||||
|
||||
PRJ=..$/..
|
||||
|
||||
PRJNAME=codemaker
|
||||
TARGET=cunomaker
|
||||
TARGETTYPE=CUI
|
||||
LIBTARGET=NO
|
||||
|
||||
ENABLE_EXCEPTIONS=TRUE
|
||||
|
||||
# --- Settings -----------------------------------------------------
|
||||
.INCLUDE : settings.mk
|
||||
|
||||
# --- Files --------------------------------------------------------
|
||||
|
||||
CXXFILES= cunomaker.cxx \
|
||||
cunooptions.cxx \
|
||||
cunotype.cxx
|
||||
|
||||
|
||||
APP1TARGET= $(TARGET)
|
||||
|
||||
APP1OBJS= $(OBJ)$/cunomaker.obj \
|
||||
$(OBJ)$/cunooptions.obj \
|
||||
$(OBJ)$/cunotype.obj
|
||||
|
||||
APP1STDLIBS= \
|
||||
$(SALLIB) \
|
||||
$(SALHELPERLIB) \
|
||||
$(REGLIB) \
|
||||
|
||||
APP1LIBS= \
|
||||
$(LB)$/codemaker.lib
|
||||
|
||||
.INCLUDE : target.mk
|
@ -1,188 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
// MARKER(update_precomp.py): autogen include statement, do not remove
|
||||
#include "precompiled_codemaker.hxx"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sal/main.h"
|
||||
|
||||
#include <codemaker/typemanager.hxx>
|
||||
#include <codemaker/dependency.hxx>
|
||||
|
||||
#include "idloptions.hxx"
|
||||
#include "idltype.hxx"
|
||||
|
||||
using namespace rtl;
|
||||
|
||||
sal_Bool produceAllTypes(const OString& typeName,
|
||||
TypeManager& typeMgr,
|
||||
TypeDependency& typeDependencies,
|
||||
IdlOptions* pOptions,
|
||||
sal_Bool bFullScope)
|
||||
throw( CannotDumpException )
|
||||
{
|
||||
if (!produceType(typeName, typeMgr, typeDependencies, pOptions))
|
||||
{
|
||||
fprintf(stderr, "%s ERROR: %s\n",
|
||||
pOptions->getProgramName().getStr(),
|
||||
OString("cannot dump Type '" + typeName + "'").getStr());
|
||||
exit(99);
|
||||
}
|
||||
|
||||
RegistryKey typeKey = typeMgr.getTypeKey(typeName);
|
||||
RegistryKeyNames subKeys;
|
||||
|
||||
if (typeKey.getKeyNames(OUString(), subKeys))
|
||||
return sal_False;
|
||||
|
||||
OString tmpName;
|
||||
for (sal_uInt32 i=0; i < subKeys.getLength(); i++)
|
||||
{
|
||||
tmpName = OUStringToOString(subKeys.getElement(i), RTL_TEXTENCODING_UTF8);
|
||||
|
||||
if (pOptions->isValid("-B"))
|
||||
tmpName = tmpName.copy(tmpName.indexOf('/', 1) + 1);
|
||||
else
|
||||
tmpName = tmpName.copy(1);
|
||||
|
||||
if (bFullScope)
|
||||
{
|
||||
if (!produceAllTypes(tmpName, typeMgr, typeDependencies, pOptions, sal_True))
|
||||
return sal_False;
|
||||
} else
|
||||
{
|
||||
if (!produceType(tmpName, typeMgr, typeDependencies, pOptions))
|
||||
return sal_False;
|
||||
}
|
||||
}
|
||||
|
||||
return sal_True;
|
||||
}
|
||||
|
||||
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
|
||||
{
|
||||
IdlOptions options;
|
||||
|
||||
try
|
||||
{
|
||||
if (!options.initOptions(argc, argv))
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
catch( IllegalArgument& e)
|
||||
{
|
||||
fprintf(stderr, "Illegal option: %s\n", e.m_message.getStr());
|
||||
exit(99);
|
||||
}
|
||||
|
||||
RegistryTypeManager typeMgr;
|
||||
TypeDependency typeDependencies;
|
||||
|
||||
if (!typeMgr.init(!options.isValid("-T"), options.getInputFiles()))
|
||||
{
|
||||
fprintf(stderr, "%s : init registries failed, check your registry files.\n", options.getProgramName().getStr());
|
||||
exit(99);
|
||||
}
|
||||
|
||||
if (options.isValid("-B"))
|
||||
{
|
||||
typeMgr.setBase(options.getOption("-B"));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (options.isValid("-T"))
|
||||
{
|
||||
OString tOption(options.getOption("-T"));
|
||||
|
||||
OString typeName, tmpName;
|
||||
sal_Bool ret = sal_False;
|
||||
sal_Int32 nIndex = 0;
|
||||
do
|
||||
{
|
||||
typeName = tOption.getToken(0, ';', nIndex);
|
||||
|
||||
sal_Int32 nPos = typeName.lastIndexOf( '.' );
|
||||
tmpName = typeName.copy( nPos != -1 ? nPos+1 : 0 );
|
||||
if (tmpName == "*")
|
||||
{
|
||||
// produce this type and his scope, but the scope is not recursively generated.
|
||||
if (typeName.equals("*"))
|
||||
{
|
||||
tmpName = "/";
|
||||
} else
|
||||
{
|
||||
tmpName = typeName.copy(0, typeName.lastIndexOf('.')).replace('.', '/');
|
||||
if (tmpName.getLength() == 0)
|
||||
tmpName = "/";
|
||||
else
|
||||
tmpName.replace('.', '/');
|
||||
}
|
||||
ret = produceAllTypes(tmpName, typeMgr, typeDependencies, &options, sal_False);
|
||||
} else
|
||||
{
|
||||
// produce only this type
|
||||
ret = produceType(typeName.replace('.', '/'), typeMgr, typeDependencies, &options);
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
fprintf(stderr, "%s ERROR: %s\n",
|
||||
options.getProgramName().getStr(),
|
||||
OString("cannot dump Type '" + typeName + "'").getStr());
|
||||
exit(99);
|
||||
}
|
||||
} while( nIndex != -1 );
|
||||
} else
|
||||
{
|
||||
// produce all types
|
||||
if (!produceAllTypes("/", typeMgr, typeDependencies, &options, sal_True))
|
||||
{
|
||||
fprintf(stderr, "%s ERROR: %s\n",
|
||||
options.getProgramName().getStr(),
|
||||
"an error occurs while dumping all types.");
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( CannotDumpException& e)
|
||||
{
|
||||
fprintf(stderr, "%s ERROR: %s\n",
|
||||
options.getProgramName().getStr(),
|
||||
e.m_message.getStr());
|
||||
exit(99);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -1,254 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
// MARKER(update_precomp.py): autogen include statement, do not remove
|
||||
#include "precompiled_codemaker.hxx"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "idloptions.hxx"
|
||||
|
||||
using namespace rtl;
|
||||
|
||||
sal_Bool IdlOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile)
|
||||
throw( IllegalArgument )
|
||||
{
|
||||
sal_Bool ret = sal_True;
|
||||
sal_uInt16 i=0;
|
||||
|
||||
if (!bCmdFile)
|
||||
{
|
||||
bCmdFile = sal_True;
|
||||
|
||||
m_program = av[0];
|
||||
|
||||
if (ac < 2)
|
||||
{
|
||||
fprintf(stderr, "%s", prepareHelp().getStr());
|
||||
ret = sal_False;
|
||||
}
|
||||
|
||||
i = 1;
|
||||
} else
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
char *s=NULL;
|
||||
for (i; i < ac; i++)
|
||||
{
|
||||
if (av[i][0] == '-')
|
||||
{
|
||||
switch (av[i][1])
|
||||
{
|
||||
case 'O':
|
||||
if (av[i][2] == '\0')
|
||||
{
|
||||
if (i < ac - 1 && av[i+1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
s = av[i];
|
||||
} else
|
||||
{
|
||||
OString tmp("'-O', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i+1]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
} else
|
||||
{
|
||||
s = av[i] + 2;
|
||||
}
|
||||
|
||||
m_options["-O"] = OString(s);
|
||||
break;
|
||||
case 'B':
|
||||
if (av[i][2] == '\0')
|
||||
{
|
||||
if (i < ac - 1 && av[i+1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
s = av[i];
|
||||
} else
|
||||
{
|
||||
OString tmp("'-B', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i+1]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
} else
|
||||
{
|
||||
s = av[i] + 2;
|
||||
}
|
||||
|
||||
m_options["-B"] = OString(s);
|
||||
break;
|
||||
case 'T':
|
||||
if (av[i][2] == '\0')
|
||||
{
|
||||
if (i < ac - 1 && av[i+1][0] != '-')
|
||||
{
|
||||
i++;
|
||||
s = av[i];
|
||||
} else
|
||||
{
|
||||
OString tmp("'-T', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i+1]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
} else
|
||||
{
|
||||
s = av[i] + 2;
|
||||
}
|
||||
|
||||
if (m_options.count("-T") > 0)
|
||||
{
|
||||
OString tmp(m_options["-T"]);
|
||||
tmp = tmp + ";" + s;
|
||||
m_options["-T"] = tmp;
|
||||
} else
|
||||
{
|
||||
m_options["-T"] = OString(s);
|
||||
}
|
||||
break;
|
||||
case 'G':
|
||||
if (av[i][2] == 'c')
|
||||
{
|
||||
if (av[i][3] != '\0')
|
||||
{
|
||||
OString tmp("'-Gc', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
|
||||
m_options["-Gc"] = OString("");
|
||||
break;
|
||||
} else
|
||||
if (av[i][2] != '\0')
|
||||
{
|
||||
OString tmp("'-G', please check");
|
||||
if (i <= ac - 1)
|
||||
{
|
||||
tmp += " your input '" + OString(av[i]) + "'";
|
||||
}
|
||||
|
||||
throw IllegalArgument(tmp);
|
||||
}
|
||||
|
||||
m_options["-G"] = OString("");
|
||||
break;
|
||||
default:
|
||||
throw IllegalArgument("the option is unknown" + OString(av[i]));
|
||||
break;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (av[i][0] == '@')
|
||||
{
|
||||
FILE* cmdFile = fopen(av[i]+1, "r");
|
||||
if( cmdFile == NULL )
|
||||
{
|
||||
fprintf(stderr, "%s", prepareHelp().getStr());
|
||||
ret = sal_False;
|
||||
} else
|
||||
{
|
||||
int rargc=0;
|
||||
char* rargv[512];
|
||||
char buffer[512];
|
||||
|
||||
while ( fscanf(cmdFile, "%s", buffer) != EOF )
|
||||
{
|
||||
rargv[rargc]= strdup(buffer);
|
||||
rargc++;
|
||||
}
|
||||
fclose(cmdFile);
|
||||
|
||||
ret = initOptions(rargc, rargv, bCmdFile);
|
||||
|
||||
for (long i=0; i < rargc; i++)
|
||||
{
|
||||
free(rargv[i]);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
m_inputFiles.push_back(av[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
OString IdlOptions::prepareHelp()
|
||||
{
|
||||
OString help("\nusing: ");
|
||||
help += m_program + " [-options] file_1 ... file_n\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";
|
||||
help += " [t1;...] type is generated. If no '-T' option is specified,\n";
|
||||
help += " then output for all types is generated.\n";
|
||||
help += " Example: 'com.sun.star.uno.XInterface' is a valid type.\n";
|
||||
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 += " -G = generate only target files which does not exists.\n";
|
||||
help += " -Gc = generate only target files which content will be changed.\n";
|
||||
help += "IMPORTANT: You lose enum values and struct, exception inheritance!\n";
|
||||
help += " Parameter name Object is translated to _Object!\n";
|
||||
help += " The type type is translated to CORBA::TypeCode!\n";
|
||||
help += " Sequences are expanded to a typedef name Sequence_..._\"name\"!\n";
|
||||
help += prepareVersion();
|
||||
|
||||
return help;
|
||||
}
|
||||
|
||||
OString IdlOptions::prepareVersion()
|
||||
{
|
||||
OString version("\nSun Microsystems (R) ");
|
||||
version += m_program + " Version 2.0\n\n";
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef INCLUDED_CODEMAKER_SOURCE_IDLMAKER_IDLOPTIONS_HXX
|
||||
#define INCLUDED_CODEMAKER_SOURCE_IDLMAKER_IDLOPTIONS_HXX
|
||||
|
||||
#include <codemaker/options.hxx>
|
||||
|
||||
class IdlOptions : public Options
|
||||
{
|
||||
public:
|
||||
IdlOptions()
|
||||
: Options() {}
|
||||
|
||||
~IdlOptions() {}
|
||||
|
||||
sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False)
|
||||
throw( IllegalArgument );
|
||||
|
||||
::rtl::OString prepareHelp();
|
||||
|
||||
::rtl::OString prepareVersion();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // INCLUDED_CODEMAKER_SOURCE_IDLMAKER_IDLOPTIONS_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
File diff suppressed because it is too large
Load Diff
@ -1,251 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef INCLUDED_CODEMAKER_SOURCE_IDLMAKER_IDLTYPE_HXX
|
||||
#define INCLUDED_CODEMAKER_SOURCE_IDLMAKER_IDLTYPE_HXX
|
||||
|
||||
#include <codemaker/typemanager.hxx>
|
||||
#include <codemaker/dependency.hxx>
|
||||
|
||||
enum BASETYPE
|
||||
{
|
||||
BT_INVALID,
|
||||
BT_VOID,
|
||||
BT_ANY,
|
||||
BT_TYPE,
|
||||
BT_BOOLEAN,
|
||||
BT_CHAR,
|
||||
BT_STRING,
|
||||
BT_FLOAT,
|
||||
BT_DOUBLE,
|
||||
BT_OCTET,
|
||||
BT_BYTE,
|
||||
BT_SHORT,
|
||||
BT_LONG,
|
||||
BT_HYPER,
|
||||
BT_UNSIGNED_SHORT,
|
||||
BT_UNSIGNED_LONG,
|
||||
BT_UNSIGNED_HYPER
|
||||
};
|
||||
|
||||
|
||||
enum IdlTypeDecl
|
||||
{
|
||||
CPPUTYPEDECL_ALLTYPES,
|
||||
CPPUTYPEDECL_NOINTERFACES,
|
||||
CPPUTYPEDECL_ONLYINTERFACES
|
||||
};
|
||||
|
||||
class IdlOptions;
|
||||
class FileStream;
|
||||
|
||||
class IdlType
|
||||
{
|
||||
public:
|
||||
IdlType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~IdlType();
|
||||
|
||||
virtual sal_Bool dump(IdlOptions* pOptions) throw( CannotDumpException );
|
||||
virtual sal_Bool dumpDependedTypes(IdlOptions* pOptions) throw( CannotDumpException );
|
||||
virtual sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException ) = 0;
|
||||
|
||||
virtual ::rtl::OString dumpHeaderDefine(FileStream& o, sal_Char* prefix );
|
||||
virtual void dumpDefaultHIncludes(FileStream& o);
|
||||
virtual void dumpInclude(FileStream& o, const ::rtl::OString& genTypeName, const ::rtl::OString& typeName, sal_Char* prefix );
|
||||
|
||||
virtual void dumpDepIncludes(FileStream& o, const ::rtl::OString& typeName, sal_Char* prefix);
|
||||
|
||||
virtual void dumpNameSpace(FileStream& o, sal_Bool bOpen = sal_True, sal_Bool bFull = sal_False, const ::rtl::OString& type="");
|
||||
|
||||
virtual void dumpType(FileStream& o, const ::rtl::OString& type)
|
||||
throw( CannotDumpException );
|
||||
::rtl::OString getBaseType(const ::rtl::OString& type);
|
||||
void dumpIdlGetType(FileStream& o, const ::rtl::OString& type, sal_Bool bDecl=sal_False, IdlTypeDecl eDeclFlag=CPPUTYPEDECL_ALLTYPES);
|
||||
BASETYPE isBaseType(const ::rtl::OString& type);
|
||||
|
||||
void dumpConstantValue(FileStream& o, sal_uInt16 index);
|
||||
|
||||
virtual sal_uInt32 getMemberCount();
|
||||
virtual sal_uInt32 getInheritedMemberCount();
|
||||
|
||||
void inc(sal_uInt32 num=4);
|
||||
void dec(sal_uInt32 num=4);
|
||||
::rtl::OString indent();
|
||||
::rtl::OString indent(sal_uInt32 num);
|
||||
protected:
|
||||
virtual sal_uInt32 checkInheritedMemberCount(const TypeReader* pReader);
|
||||
|
||||
::rtl::OString checkSpecialIdlType(const ::rtl::OString& type);
|
||||
::rtl::OString checkRealBaseType(const ::rtl::OString& type, sal_Bool bResolveTypeOnly = sal_False);
|
||||
|
||||
protected:
|
||||
sal_uInt32 m_inheritedMemberCount;
|
||||
|
||||
sal_uInt32 m_indentLength;
|
||||
::rtl::OString m_typeName;
|
||||
::rtl::OString m_name;
|
||||
TypeReader m_reader;
|
||||
TypeManager& m_typeMgr;
|
||||
TypeDependency m_dependencies;
|
||||
};
|
||||
|
||||
class InterfaceType : public IdlType
|
||||
{
|
||||
public:
|
||||
InterfaceType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~InterfaceType();
|
||||
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
|
||||
void dumpAttributes(FileStream& o);
|
||||
void dumpMethods(FileStream& o);
|
||||
|
||||
sal_uInt32 getMemberCount();
|
||||
sal_uInt32 getInheritedMemberCount();
|
||||
|
||||
protected:
|
||||
sal_uInt32 checkInheritedMemberCount(const TypeReader* pReader);
|
||||
|
||||
protected:
|
||||
sal_uInt32 m_inheritedMemberCount;
|
||||
sal_Bool m_hasAttributes;
|
||||
sal_Bool m_hasMethods;
|
||||
};
|
||||
|
||||
class ModuleType : public IdlType
|
||||
{
|
||||
public:
|
||||
ModuleType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~ModuleType();
|
||||
|
||||
virtual sal_Bool dump(IdlOptions* pOptions) throw( CannotDumpException );
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
sal_Bool hasConstants();
|
||||
};
|
||||
|
||||
class ConstantsType : public ModuleType
|
||||
{
|
||||
public:
|
||||
ConstantsType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~ConstantsType();
|
||||
|
||||
virtual sal_Bool dump(IdlOptions* pOptions) throw( CannotDumpException );
|
||||
};
|
||||
|
||||
class StructureType : public IdlType
|
||||
{
|
||||
public:
|
||||
StructureType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~StructureType();
|
||||
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
|
||||
void dumpSuperMember(FileStream& o, const ::rtl::OString& super);
|
||||
};
|
||||
|
||||
class ExceptionType : public IdlType
|
||||
{
|
||||
public:
|
||||
ExceptionType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~ExceptionType();
|
||||
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
|
||||
void dumpSuperMember(FileStream& o, const ::rtl::OString& super);
|
||||
};
|
||||
|
||||
class EnumType : public IdlType
|
||||
{
|
||||
public:
|
||||
EnumType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~EnumType();
|
||||
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
};
|
||||
|
||||
class TypeDefType : public IdlType
|
||||
{
|
||||
public:
|
||||
TypeDefType(TypeReader& typeReader,
|
||||
const ::rtl::OString& typeName,
|
||||
const TypeManager& typeMgr,
|
||||
const TypeDependency& typeDependencies);
|
||||
|
||||
virtual ~TypeDefType();
|
||||
|
||||
sal_Bool dumpHFile(FileStream& o) throw( CannotDumpException );
|
||||
};
|
||||
|
||||
|
||||
sal_Bool produceType(const ::rtl::OString& typeName,
|
||||
TypeManager& typeMgr,
|
||||
TypeDependency& typeDependencies,
|
||||
IdlOptions* pOptions)
|
||||
throw( CannotDumpException );
|
||||
|
||||
/**
|
||||
* This function returns a C++ scoped name, represents the namespace
|
||||
* scoping of this type, e.g. com:.sun::star::uno::XInterface. If the scope of
|
||||
* the type is equal scope, the relativ name will be used.
|
||||
*/
|
||||
::rtl::OString scopedName(const ::rtl::OString& scope, const ::rtl::OString& type, sal_Bool bNoNameSpace = sal_False );
|
||||
|
||||
::rtl::OString scope(const ::rtl::OString& scope, const ::rtl::OString& type );
|
||||
|
||||
|
||||
#endif // INCLUDED_CODEMAKER_SOURCE_IDLMAKER_IDLTYPE_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -1,62 +0,0 @@
|
||||
#*************************************************************************
|
||||
#
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# Copyright 2000, 2010 Oracle and/or its affiliates.
|
||||
#
|
||||
# OpenOffice.org - a multi-platform office productivity suite
|
||||
#
|
||||
# This file is part of OpenOffice.org.
|
||||
#
|
||||
# OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License version 3
|
||||
# only, as published by the Free Software Foundation.
|
||||
#
|
||||
# OpenOffice.org is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License version 3 for more details
|
||||
# (a copy is included in the LICENSE file that accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# version 3 along with OpenOffice.org. If not, see
|
||||
# <http://www.openoffice.org/license.html>
|
||||
# for a copy of the LGPLv3 License.
|
||||
#
|
||||
#*************************************************************************
|
||||
|
||||
PRJ=..$/..
|
||||
|
||||
PRJNAME=codemaker
|
||||
TARGET=idlmaker
|
||||
TARGETTYPE=CUI
|
||||
LIBTARGET=NO
|
||||
|
||||
ENABLE_EXCEPTIONS=TRUE
|
||||
|
||||
# --- Settings -----------------------------------------------------
|
||||
.INCLUDE : settings.mk
|
||||
|
||||
# --- Files --------------------------------------------------------
|
||||
|
||||
CXXFILES= idlmaker.cxx \
|
||||
idloptions.cxx \
|
||||
idltype.cxx
|
||||
|
||||
|
||||
APP1TARGET= $(TARGET)
|
||||
|
||||
APP1OBJS= $(OBJ)$/idlmaker.obj \
|
||||
$(OBJ)$/idloptions.obj \
|
||||
$(OBJ)$/idltype.obj
|
||||
|
||||
APP1STDLIBS= \
|
||||
$(SALLIB) \
|
||||
$(SALHELPERLIB) \
|
||||
$(REGLIB) \
|
||||
$(STDLIBCPP)
|
||||
|
||||
APP1LIBS= \
|
||||
$(LB)$/codemaker.lib
|
||||
|
||||
.INCLUDE : target.mk
|
Loading…
x
Reference in New Issue
Block a user