summaryrefslogtreecommitdiff
path: root/idlc
diff options
context:
space:
mode:
authorJuergen Schmidt <jsc@openoffice.org>2001-05-18 14:38:10 +0000
committerJuergen Schmidt <jsc@openoffice.org>2001-05-18 14:38:10 +0000
commitf3097d7b52b481bfec4e6235c9396738ea3aa9f2 (patch)
treead68b788aa60bc47b6b18056a54c75db07618e38 /idlc
parent465b869e784fa0a3641f36a1d65d29605447d3bd (diff)
#87233# insert singleton
Diffstat (limited to 'idlc')
-rw-r--r--idlc/inc/idlc/astdeclaration.hxx7
-rw-r--r--idlc/inc/idlc/astservice.hxx8
-rw-r--r--idlc/inc/idlc/idlctypes.hxx12
-rw-r--r--idlc/source/astdeclaration.cxx5
-rw-r--r--idlc/source/astdump.cxx200
-rw-r--r--idlc/source/idlc.cxx6
-rw-r--r--idlc/source/scanner.ll5
7 files changed, 143 insertions, 100 deletions
diff --git a/idlc/inc/idlc/astdeclaration.hxx b/idlc/inc/idlc/astdeclaration.hxx
index bc887c4e1aa0..7716e31b9361 100644
--- a/idlc/inc/idlc/astdeclaration.hxx
+++ b/idlc/inc/idlc/astdeclaration.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: astdeclaration.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $
+ * last change: $Author: jsc $ $Date: 2001-05-18 15:33:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -101,7 +101,8 @@ enum NodeType
NT_array, // Denotes an IDL array
NT_sequence, // Denotes an IDL sequence
NT_typedef, // Denotes a typedef
- NT_predefined // Denotes a predefined type
+ NT_predefined, // Denotes a predefined type
+ NT_singleton // Denotes a singleton
};
class AstDeclaration
diff --git a/idlc/inc/idlc/astservice.hxx b/idlc/inc/idlc/astservice.hxx
index dee7b4727be5..c2ec56d30c4a 100644
--- a/idlc/inc/idlc/astservice.hxx
+++ b/idlc/inc/idlc/astservice.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: astservice.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $
+ * last change: $Author: jsc $ $Date: 2001-05-18 15:33:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,10 @@ public:
: AstDeclaration(NT_service, name, pScope)
, AstScope(NT_service)
{}
+ AstService(const NodeType type, const ::rtl::OString& name, AstScope* pScope)
+ : AstDeclaration(type, name, pScope)
+ , AstScope(type)
+ {}
virtual ~AstService() {}
virtual sal_Bool dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader);
diff --git a/idlc/inc/idlc/idlctypes.hxx b/idlc/inc/idlc/idlctypes.hxx
index fde3364ec1c4..bb9f9f66ad87 100644
--- a/idlc/inc/idlc/idlctypes.hxx
+++ b/idlc/inc/idlc/idlctypes.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: idlctypes.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $
+ * last change: $Author: jsc $ $Date: 2001-05-18 15:33:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -144,6 +144,7 @@ enum ParseState
PS_ExceptionDeclSeen, // Seen complete exception declaration
PS_InterfaceDeclSeen, // Seen complete interface declaration
PS_ServiceDeclSeen, // Seen complete service declaration
+ PS_SingletonDeclSeen, // Seen complete singleton declaration
PS_ModuleDeclSeen, // Seen complete module declaration
PS_AttributeDeclSeen, // Seen complete attribute declaration
PS_PropertyDeclSeen, // Seen complete property declaration
@@ -159,6 +160,13 @@ enum ParseState
PS_ServiceIFHeadSeen, // Seen an interface member header
PS_ServiceSHeadSeen, // Seen an service member header
+ PS_SingletonSeen, // Seen a SINGLETON keyword
+ PS_SingletonIDSeen, // Seen the singleton ID
+ PS_SingletonSqSeen, // '{' seen for singleton
+ PS_SingletonQsSeen, // '}' seen for singleton
+ PS_SingletonBodySeen, // Seen complete singleton body
+ PS_SingletonMemberSeen, // Seen a singleton member
+
PS_ModuleSeen, // Seen a MODULE keyword
PS_ModuleIDSeen, // Seen the module ID
PS_ModuleSqSeen, // '{' seen for module
diff --git a/idlc/source/astdeclaration.cxx b/idlc/source/astdeclaration.cxx
index e1ebe315138c..83b22a69a7a1 100644
--- a/idlc/source/astdeclaration.cxx
+++ b/idlc/source/astdeclaration.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: astdeclaration.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: pl $ $Date: 2001-05-10 16:29:19 $
+ * last change: $Author: jsc $ $Date: 2001-05-18 15:38:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -220,6 +220,7 @@ sal_Bool AstDeclaration::dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoad
case NT_union:
case NT_typedef:
case NT_service:
+ case NT_singleton:
bRet = pDecl->dump(rKey, pLoader);
}
}
diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx
index 137971e73dff..c819ac99da82 100644
--- a/idlc/source/astdump.cxx
+++ b/idlc/source/astdump.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: astdump.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jsc $ $Date: 2001-04-11 07:24:23 $
+ * last change: $Author: jsc $ $Date: 2001-05-18 15:38:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -232,112 +232,138 @@ sal_Bool AstService::dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader)
return sal_False;
}
- sal_uInt16 nProperties = 0;
- sal_uInt16 nIfaceMember = 0;
- sal_uInt16 nServMember = 0;
- sal_uInt16 nNeeds = 0;
- sal_uInt16 nObserves = 0;
- if ( nMembers() > 0 )
+ if ( getNodeType() == NT_singleton )
{
DeclList::iterator iter = getIteratorBegin();
- DeclList::iterator end = getIteratorEnd();
- while ( iter != end )
+ OString tmp((*iter)->getRelativName());
+
+ RegistryTypeWriter aBlob(pLoader->getApi(), RT_TYPE_SINGLETON,
+ OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8),
+ OStringToOUString((*iter)->getRelativName(), RTL_TEXTENCODING_UTF8),
+ 0, 0, 0);
+
+ aBlob.setDoku( getDocumentation() );
+ aBlob.setFileName( OStringToOUString(getFileName(), RTL_TEXTENCODING_UTF8));
+
+ const sal_uInt8* pBlob = aBlob.getBlop();
+ sal_uInt32 aBlobSize = aBlob.getBlopSize();
+
+ if (localKey.setValue(OUString(), RG_VALUETYPE_BINARY,
+ (RegValue)pBlob, aBlobSize))
{
- switch ( (*iter)->getNodeType() )
+ fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
+ idlc()->getOptions()->getProgramName().getStr(),
+ getFullName(), localKey.getRegistryName());
+ return sal_False;
+ }
+ } else
+ {
+ sal_uInt16 nProperties = 0;
+ sal_uInt16 nIfaceMember = 0;
+ sal_uInt16 nServMember = 0;
+ sal_uInt16 nNeeds = 0;
+ sal_uInt16 nObserves = 0;
+ if ( nMembers() > 0 )
+ {
+ DeclList::iterator iter = getIteratorBegin();
+ DeclList::iterator end = getIteratorEnd();
+ while ( iter != end )
+ {
+ switch ( (*iter)->getNodeType() )
+ {
+ case NT_property:
+ nProperties++;
+ break;
+ case NT_interface_member:
+ nIfaceMember++;
+ break;
+ case NT_service_member:
+ nServMember++;
+ break;
+ case NT_observes:
+ nObserves++;
+ break;
+ case NT_needs:
+ nNeeds++;
+ break;
+ }
+ ++iter;
+ }
+ }
+ sal_uInt16 nReferences = nIfaceMember + nServMember + nObserves + nNeeds;
+
+ RegistryTypeWriter aBlob(pLoader->getApi(), RT_TYPE_SERVICE,
+ OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8),
+ OUString(), nProperties, 0, nReferences);
+
+ aBlob.setDoku( getDocumentation() );
+ aBlob.setFileName( OStringToOUString(getFileName(), RTL_TEXTENCODING_UTF8));
+
+ if ( nProperties || nReferences )
+ {
+ DeclList::iterator iter = getIteratorBegin();
+ DeclList::iterator end = getIteratorEnd();
+ AstDeclaration* pDecl = NULL;
+ sal_uInt16 propertyIndex = 0;
+ sal_uInt16 referenceIndex = 0;
+ while ( iter != end )
{
+ pDecl = *iter;
+ switch ( pDecl->getNodeType() )
+ {
case NT_property:
- nProperties++;
+ ((AstAttribute*)pDecl)->dumpBlob(aBlob, propertyIndex++);
break;
case NT_interface_member:
- nIfaceMember++;
+ {
+ AstInterfaceMember* pIfaceMember = (AstInterfaceMember*)pDecl;
+ sal_uInt16 access = (pIfaceMember->isOptional() ? RT_ACCESS_OPTIONAL : RT_ACCESS_INVALID);
+ aBlob.setReferenceData(referenceIndex++,
+ OStringToOUString( pIfaceMember->getRealInterface()->getRelativName(), RTL_TEXTENCODING_UTF8),
+ RT_REF_SUPPORTS, pIfaceMember->getDocumentation(), access);
+ }
break;
case NT_service_member:
- nServMember++;
+ {
+ AstServiceMember* pServMember = (AstServiceMember*)pDecl;
+ aBlob.setReferenceData(referenceIndex++,
+ OStringToOUString( pServMember->getRealService()->getRelativName(), RTL_TEXTENCODING_UTF8),
+ RT_REF_EXPORTS, pServMember->getDocumentation());
+ }
break;
case NT_observes:
- nObserves++;
+ {
+ AstObserves* pObserves = (AstObserves*)pDecl;
+ aBlob.setReferenceData(referenceIndex++,
+ OStringToOUString( pObserves->getRealInterface()->getRelativName(), RTL_TEXTENCODING_UTF8),
+ RT_REF_OBSERVES, pObserves->getDocumentation());
+ }
break;
case NT_needs:
- nNeeds++;
+ {
+ AstNeeds* pNeeds = (AstNeeds*)pDecl;
+ aBlob.setReferenceData(referenceIndex++,
+ OStringToOUString( pNeeds->getRealService()->getRelativName(), RTL_TEXTENCODING_UTF8),
+ RT_REF_NEEDS, pNeeds->getDocumentation());
+ }
break;
+ }
+ ++iter;
}
- ++iter;
- }
- }
- sal_uInt16 nReferences = nIfaceMember + nServMember + nObserves + nNeeds;
- RegistryTypeWriter aBlob(pLoader->getApi(), RT_TYPE_SERVICE,
- OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8),
- OUString(), nProperties, 0, nReferences);
+ const sal_uInt8* pBlob = aBlob.getBlop();
+ sal_uInt32 aBlobSize = aBlob.getBlopSize();
- aBlob.setDoku( getDocumentation() );
- aBlob.setFileName( OStringToOUString(getFileName(), RTL_TEXTENCODING_UTF8));
-
- if ( nProperties || nReferences )
- {
- DeclList::iterator iter = getIteratorBegin();
- DeclList::iterator end = getIteratorEnd();
- AstDeclaration* pDecl = NULL;
- sal_uInt16 propertyIndex = 0;
- sal_uInt16 referenceIndex = 0;
- while ( iter != end )
- {
- pDecl = *iter;
- switch ( pDecl->getNodeType() )
- {
- case NT_property:
- ((AstAttribute*)pDecl)->dumpBlob(aBlob, propertyIndex++);
- break;
- case NT_interface_member:
- {
- AstInterfaceMember* pIfaceMember = (AstInterfaceMember*)pDecl;
- sal_uInt16 access = (pIfaceMember->isOptional() ? RT_ACCESS_OPTIONAL : RT_ACCESS_INVALID);
- aBlob.setReferenceData(referenceIndex++,
- OStringToOUString( pIfaceMember->getRealInterface()->getRelativName(), RTL_TEXTENCODING_UTF8),
- RT_REF_SUPPORTS, pIfaceMember->getDocumentation(), access);
- }
- break;
- case NT_service_member:
- {
- AstServiceMember* pServMember = (AstServiceMember*)pDecl;
- aBlob.setReferenceData(referenceIndex++,
- OStringToOUString( pServMember->getRealService()->getRelativName(), RTL_TEXTENCODING_UTF8),
- RT_REF_EXPORTS, pServMember->getDocumentation());
- }
- break;
- case NT_observes:
- {
- AstObserves* pObserves = (AstObserves*)pDecl;
- aBlob.setReferenceData(referenceIndex++,
- OStringToOUString( pObserves->getRealInterface()->getRelativName(), RTL_TEXTENCODING_UTF8),
- RT_REF_OBSERVES, pObserves->getDocumentation());
- }
- break;
- case NT_needs:
+ if (localKey.setValue(OUString(), RG_VALUETYPE_BINARY,
+ (RegValue)pBlob, aBlobSize))
{
- AstNeeds* pNeeds = (AstNeeds*)pDecl;
- aBlob.setReferenceData(referenceIndex++,
- OStringToOUString( pNeeds->getRealService()->getRelativName(), RTL_TEXTENCODING_UTF8),
- RT_REF_NEEDS, pNeeds->getDocumentation());
- }
- break;
+ fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
+ idlc()->getOptions()->getProgramName().getStr(),
+ getFullName(), localKey.getRegistryName());
+ return sal_False;
}
- ++iter;
- }
-
- const sal_uInt8* pBlob = aBlob.getBlop();
- sal_uInt32 aBlobSize = aBlob.getBlopSize();
-
- if (localKey.setValue(OUString(), RG_VALUETYPE_BINARY,
- (RegValue)pBlob, aBlobSize))
- {
- fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
- idlc()->getOptions()->getProgramName().getStr(),
- getFullName(), localKey.getRegistryName());
- return sal_False;
}
}
-
return sal_True;
}
diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx
index 756ca6ae5f28..568f852c9e65 100644
--- a/idlc/source/idlc.cxx
+++ b/idlc/source/idlc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: idlc.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jsc $ $Date: 2001-03-15 12:30:43 $
+ * last change: $Author: jsc $ $Date: 2001-05-18 15:38:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,6 +105,7 @@ AstDeclaration* SAL_CALL scopeAsDecl(AstScope* pScope)
switch( pScope->getScopeNodeType() )
{
case NT_service:
+ case NT_singleton:
return (AstService*)(pScope);
case NT_module:
case NT_root:
@@ -137,6 +138,7 @@ AstScope* SAL_CALL declAsScope(AstDeclaration* pDecl)
case NT_interface:
return (AstInterface*)(pDecl);
case NT_service:
+ case NT_singleton:
return (AstService*)(pDecl);
case NT_module:
case NT_root:
diff --git a/idlc/source/scanner.ll b/idlc/source/scanner.ll
index 2e968fe23c68..40bb2a5fb1fa 100644
--- a/idlc/source/scanner.ll
+++ b/idlc/source/scanner.ll
@@ -2,9 +2,9 @@
*
* $RCSfile: scanner.ll,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: pl $ $Date: 2001-05-10 13:07:49 $
+ * last change: $Author: jsc $ $Date: 2001-05-18 15:38:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -272,6 +272,7 @@ readonly return IDL_READONLY;
removable return IDL_REMOVEABLE;
service return IDL_SERVICE;
sequence return IDL_SEQUENCE;
+singleton return IDL_SINGLETON;
struct return IDL_STRUCT;
switch return IDL_SWITCH;
transient return IDL_TRANSIENT;