Add RPC proxy support

svn path=/trunk/; revision=31812
This commit is contained in:
Hervé Poussineau
2008-01-15 18:08:25 +00:00
parent 0f61bddc45
commit d2821af997
7 changed files with 125 additions and 24 deletions
@@ -363,7 +363,12 @@ CBBackend::_generate_cbproj ( const Module& module )
string project_linker_flags = "-Wl,--enable-stdcall-fixup ";
project_linker_flags += GenerateProjectLinkerFlags();
bool lib = (module.type == ObjectLibrary) || (module.type == RpcClient) ||(module.type == RpcServer) || (module_type == ".lib") || (module_type == ".a");
bool lib = (module.type == ObjectLibrary) ||
(module.type == RpcClient) ||
(module.type == RpcServer) ||
(module.type == RpcProxy) ||
(module_type == ".lib") ||
(module_type == ".a");
bool dll = (module_type == ".dll") || (module_type == ".cpl");
bool exe = (module_type == ".exe") || (module_type == ".scr");
bool sys = (module_type == ".sys");
@@ -229,6 +229,9 @@ MingwModuleHandler::InstanciateHandler (
case RpcClient:
handler = new MingwRpcClientModuleHandler ( module );
break;
case RpcProxy:
handler = new MingwRpcProxyModuleHandler ( module );
break;
case Alias:
handler = new MingwAliasModuleHandler ( module );
break;
@@ -284,7 +287,7 @@ MingwModuleHandler::GetActualSourceFilename (
return sourceFile;
}
else if ( ( extension == ".idl" || extension == ".IDL" ) &&
( module.type == RpcServer || module.type == RpcClient ) )
( module.type == RpcServer || module.type == RpcClient || module.type == RpcProxy ) )
{
const FileLocation *objectFile = GetObjectFilename ( file, module, NULL );
FileLocation *sourceFile = new FileLocation (
@@ -315,25 +318,21 @@ MingwModuleHandler::GetExtraDependencies (
string extension = GetExtension ( *file );
if ( extension == ".idl" || extension == ".IDL" )
{
if ( (module.type == RpcServer) || (module.type == RpcClient) )
const FileLocation *header;
switch ( module.type )
{
const FileLocation *server_header = GetRpcServerHeaderFilename ( file );
const FileLocation *client_header = GetRpcClientHeaderFilename ( file );
string dependencies = backend->GetFullName ( *server_header ) + " " +
backend->GetFullName ( *client_header );
delete server_header;
delete client_header;
return dependencies;
case RpcServer: header = GetRpcServerHeaderFilename ( file ); break;
case RpcClient: header = GetRpcClientHeaderFilename ( file ); break;
case RpcProxy: header = GetRpcProxyHeaderFilename ( file ); break;
case IdlHeader: header = GetIdlHeaderFilename ( file ); break;
default: header = NULL; break;
}
else if ( module.type == IdlHeader )
{
const FileLocation *idl_header = GetIdlHeaderFilename ( file );
string dependencies = backend->GetFullName ( *idl_header );
delete idl_header;
return dependencies;
}
else
if ( !header )
return "";
string dependencies = backend->GetFullName ( *header );
delete header;
return dependencies;
}
else
return "";
@@ -382,6 +381,8 @@ MingwModuleHandler::ReferenceObjects (
return true;
if ( module.type == RpcClient )
return true;
if ( module.type == RpcProxy )
return true;
if ( module.type == IdlHeader )
return true;
return false;
@@ -547,6 +548,8 @@ MingwModuleHandler::GetObjectFilename (
newExtension = "_s.o";
else if ( module.type == RpcClient )
newExtension = "_c.o";
else if ( module.type == RpcProxy )
newExtension = "_p.o";
else
newExtension = ".h";
}
@@ -1520,6 +1523,14 @@ MingwModuleHandler::GetRpcClientHeaderFilename ( const FileLocation *base ) cons
return new FileLocation ( IntermediateDirectory, base->relative_path, newname );
}
/* caller needs to delete the returned object */
const FileLocation*
MingwModuleHandler::GetRpcProxyHeaderFilename ( const FileLocation *base ) const
{
string newname = GetBasename ( base->name ) + "_p.h";
return new FileLocation ( IntermediateDirectory, base->relative_path, newname );
}
/* caller needs to delete the returned object */
const FileLocation*
MingwModuleHandler::GetIdlHeaderFilename ( const FileLocation *base ) const
@@ -1604,6 +1615,44 @@ MingwModuleHandler::GenerateWidlCommandsClient (
delete generatedHeaderFilename;
}
void
MingwModuleHandler::GenerateWidlCommandsProxy (
const CompilationUnit& compilationUnit,
const string& widlflagsMacro )
{
const FileLocation& sourceFile = compilationUnit.GetFilename ();
string dependencies = backend->GetFullName ( sourceFile );
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string basename = GetBasename ( sourceFile.name );
const FileLocation *generatedHeaderFilename = GetRpcProxyHeaderFilename ( &sourceFile );
CLEAN_FILE ( *generatedHeaderFilename );
FileLocation generatedProxyFilename ( IntermediateDirectory,
sourceFile.relative_path,
basename + "_p.c" );
CLEAN_FILE ( generatedProxyFilename );
fprintf ( fMakefile,
"%s %s: %s $(WIDL_TARGET) | %s\n",
backend->GetFullName ( generatedProxyFilename ).c_str (),
backend->GetFullName ( *generatedHeaderFilename ).c_str (),
dependencies.c_str (),
backend->GetFullPath ( generatedProxyFilename ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" );
fprintf ( fMakefile,
"\t%s %s %s -h -H %s -p -P %s %s\n",
"$(Q)$(WIDL_TARGET)",
GetWidlFlags ( compilationUnit ).c_str (),
widlflagsMacro.c_str (),
backend->GetFullName ( *generatedHeaderFilename ).c_str (),
backend->GetFullName ( generatedProxyFilename ).c_str (),
backend->GetFullName ( sourceFile ).c_str () );
delete generatedHeaderFilename;
}
void
MingwModuleHandler::GenerateWidlCommandsIdlHeader (
const CompilationUnit& compilationUnit,
@@ -1646,6 +1695,9 @@ MingwModuleHandler::GenerateWidlCommands (
else if ( module.type == RpcClient )
GenerateWidlCommandsClient ( compilationUnit,
widlflagsMacro );
else if ( module.type == RpcProxy )
GenerateWidlCommandsProxy ( compilationUnit,
widlflagsMacro );
else if ( module.type == EmbeddedTypeLib )
GenerateWidlCommandsEmbeddedTypeLib ( compilationUnit,
widlflagsMacro );
@@ -1715,7 +1767,7 @@ MingwModuleHandler::GenerateCommands (
{
GenerateWidlCommands ( compilationUnit,
widlflagsMacro );
if ( (module.type == RpcServer) || (module.type == RpcClient) )
if ( (module.type == RpcServer) || (module.type == RpcClient) || (module.type == RpcProxy) )
{
GenerateGccCommand ( &sourceFile,
GetExtraDependencies ( &sourceFile ),
@@ -2235,6 +2287,7 @@ MingwModuleHandler::GetRpcHeaderDependencies (
Library& library = *module.non_if_data.libraries[i];
if ( library.importedModule->type == RpcServer ||
library.importedModule->type == RpcClient ||
library.importedModule->type == RpcProxy ||
library.importedModule->type == IdlHeader )
{
for ( size_t j = 0; j < library.importedModule->non_if_data.compilationUnits.size (); j++ )
@@ -2257,6 +2310,12 @@ MingwModuleHandler::GetRpcHeaderDependencies (
dependencies.push_back ( *header );
delete header;
}
if ( library.importedModule->type == RpcProxy )
{
const FileLocation *header = GetRpcProxyHeaderFilename ( &sourceFile );
dependencies.push_back ( *header );
delete header;
}
if ( library.importedModule->type == IdlHeader )
{
const FileLocation *header = GetIdlHeaderFilename ( &sourceFile );
@@ -2736,7 +2795,7 @@ MingwModuleHandler::GetDefinitionDependencies (
GetSpecObjectDependencies ( dependencies, &sourceFile );
if ( extension == ".idl" || extension == ".IDL" )
{
if ( ( module.type == RpcServer ) || ( module.type == RpcClient ) )
if ( ( module.type == RpcServer ) || ( module.type == RpcClient ) || ( module.type == RpcProxy ) )
GetWidlObjectDependencies ( dependencies, &sourceFile );
}
}
@@ -4074,6 +4133,20 @@ MingwRpcClientModuleHandler::Process ()
}
MingwRpcProxyModuleHandler::MingwRpcProxyModuleHandler (
const Module& module_ )
: MingwModuleHandler ( module_ )
{
}
void
MingwRpcProxyModuleHandler::Process ()
{
GenerateRules ();
}
MingwAliasModuleHandler::MingwAliasModuleHandler (
const Module& module_ )
@@ -171,6 +171,9 @@ private:
void GenerateWidlCommandsClient (
const CompilationUnit& compilationUnit,
const std::string& widlflagsMacro );
void GenerateWidlCommandsProxy (
const CompilationUnit& compilationUnit,
const std::string& widlflagsMacro );
void GenerateWidlCommandsIdlHeader (
const CompilationUnit& compilationUnit,
const std::string& widlflagsMacro );
@@ -215,12 +218,13 @@ private:
void GenerateBuildNonSymbolStrippedCode ();
void CleanupCompilationUnitVector ( std::vector<CompilationUnit*>& compilationUnits );
void GetRpcHeaderDependencies ( std::vector<FileLocation>& dependencies ) const;
void GetMcHeaderDependencies ( std::vector<FileLocation>& dependencies ) const;
void GetMcHeaderDependencies ( std::vector<FileLocation>& dependencies ) const;
static std::string GetPropertyValue ( const Module& module, const std::string& name );
const FileLocation* GetRpcServerHeaderFilename ( const FileLocation *base ) const;
const FileLocation* GetRpcClientHeaderFilename ( const FileLocation *base ) const;
const FileLocation* GetRpcProxyHeaderFilename ( const FileLocation *base ) const;
const FileLocation* GetIdlHeaderFilename ( const FileLocation *base ) const;
const FileLocation* GetMcHeaderFilename ( const FileLocation *base ) const;
const FileLocation* GetMcHeaderFilename ( const FileLocation *base ) const;
std::string GetModuleCleanTarget ( const Module& module ) const;
void GetReferencedObjectLibraryModuleCleanTargets ( std::vector<std::string>& moduleNames ) const;
public:
@@ -494,6 +498,16 @@ public:
virtual void Process ();
};
class MingwRpcProxyModuleHandler : public MingwModuleHandler
{
public:
MingwRpcProxyModuleHandler ( const Module& module );
virtual HostType DefaultHost() { return HostFalse; }
virtual void Process ();
};
class MingwAliasModuleHandler : public MingwModuleHandler
{
public:
+1
View File
@@ -65,6 +65,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type )
case Test:
case RpcServer:
case RpcClient:
case RpcProxy:
case Alias:
case IdlHeader:
case EmbeddedTypeLib:
+1
View File
@@ -118,6 +118,7 @@ Include::GetDefaultDirectoryTree ( const Module* module ) const
if ( module != NULL &&
( module->type == RpcServer ||
module->type == RpcClient ||
module->type == RpcProxy ||
module->type == IdlHeader) )
return IntermediateDirectory;
else
+7 -1
View File
@@ -913,6 +913,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
return RpcServer;
if ( attribute.value == "rpcclient" )
return RpcClient;
if ( attribute.value == "rpcproxy" )
return RpcProxy;
if ( attribute.value == "alias" )
return Alias;
if ( attribute.value == "idlheader" )
@@ -957,6 +959,7 @@ Module::GetTargetDirectoryTree () const
case ObjectLibrary:
case RpcServer:
case RpcClient:
case RpcProxy:
case Alias:
case IdlHeader:
return IntermediateDirectory;
@@ -1006,8 +1009,8 @@ Module::GetDefaultModuleExtension () const
case Test:
return ".exe";
case RpcServer:
return ".o";
case RpcClient:
case RpcProxy:
return ".o";
case Alias:
case ElfExecutable:
@@ -1060,6 +1063,7 @@ Module::GetDefaultModuleEntrypoint () const
case LiveIsoRegTest:
case RpcServer:
case RpcClient:
case RpcProxy:
case Alias:
case BootProgram:
case IdlHeader:
@@ -1105,6 +1109,7 @@ Module::GetDefaultModuleBaseaddress () const
case LiveIsoRegTest:
case RpcServer:
case RpcClient:
case RpcProxy:
case Alias:
case BootProgram:
case IdlHeader:
@@ -1150,6 +1155,7 @@ Module::IsDLL () const
case LiveIsoRegTest:
case RpcServer:
case RpcClient:
case RpcProxy:
case Alias:
case IdlHeader:
case EmbeddedTypeLib:
+2 -1
View File
@@ -299,7 +299,8 @@ enum ModuleType
IsoRegTest = 24,
LiveIsoRegTest = 25,
EmbeddedTypeLib = 26,
ElfExecutable = 27
ElfExecutable = 27,
RpcProxy,
};
enum HostType